Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how to setfocus..

how to setfocus..

Scheduled Pinned Locked Moved C / C++ / MFC
questiontutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mpallavi
    wrote on last edited by
    #1

    hi ->how do i setfocus to a particular field on the window? (CWnd::setfocus() always sets focus to the first field).. ->i save the user input in a text file.. when i open the file, the first character is always a garbage value.. why? regards pallavi

    T 1 Reply Last reply
    0
    • M mpallavi

      hi ->how do i setfocus to a particular field on the window? (CWnd::setfocus() always sets focus to the first field).. ->i save the user input in a text file.. when i open the file, the first character is always a garbage value.. why? regards pallavi

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      All your controls inherit from CWnd, so :

      CEdit* pEdit = GetDlgItem(IDC_MYEDIT);
      CComboBox* pCombo = GetDlgItem(IDC_MYCOMBO);
      CStatic* pStatic= GetDlgItem(IDC_MYSTATIC);

      //...

      pEdit->SetFocus();
      pCombo->SetFocus();
      pStatic->SetFocus();

      cheers,


      TOXCCT >>> GEII power
      [toxcct][VisualCalc]

      M 1 Reply Last reply
      0
      • T toxcct

        All your controls inherit from CWnd, so :

        CEdit* pEdit = GetDlgItem(IDC_MYEDIT);
        CComboBox* pCombo = GetDlgItem(IDC_MYCOMBO);
        CStatic* pStatic= GetDlgItem(IDC_MYSTATIC);

        //...

        pEdit->SetFocus();
        pCombo->SetFocus();
        pStatic->SetFocus();

        cheers,


        TOXCCT >>> GEII power
        [toxcct][VisualCalc]

        M Offline
        M Offline
        mpallavi
        wrote on last edited by
        #3

        thanx buddy I am a beginner in vc++ .. and used to VB programming.. thank you! regards pal

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups