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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. setfocus

setfocus

Scheduled Pinned Locked Moved C / C++ / MFC
question
13 Posts 8 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.
  • B bhogavalli suresh

    how do i set focus in one of my edit control in property sheet

    S Offline
    S Offline
    Sunil P V
    wrote on last edited by
    #2

    Assume the ID of your edit control is IDC_EDIT_NAMETAG, to set the focus do the following: CWnd* pEditCtrl = GetDlgItem(IDC_EDIT_NAMETAG); pEditCtrl->SetFocus();

    Sunil

    S 1 Reply Last reply
    0
    • B bhogavalli suresh

      how do i set focus in one of my edit control in property sheet

      Z Offline
      Z Offline
      zakkas2483
      wrote on last edited by
      #3

      GetDlgItem( ID )->SetCapture(); Where ID is the id Of the Edit control ok. hiren thakkar

      N 1 Reply Last reply
      0
      • Z zakkas2483

        GetDlgItem( ID )->SetCapture(); Where ID is the id Of the Edit control ok. hiren thakkar

        N Offline
        N Offline
        Naveen
        wrote on last edited by
        #4

        zakkas2483 wrote:

        GetDlgItem( ID )->SetCapture();

        :confused: Purpose of SetCapture() API is different.Did you really mean SetCapture itself?

        nave [OpenedFileFinder]

        Z 1 Reply Last reply
        0
        • N Naveen

          zakkas2483 wrote:

          GetDlgItem( ID )->SetCapture();

          :confused: Purpose of SetCapture() API is different.Did you really mean SetCapture itself?

          nave [OpenedFileFinder]

          Z Offline
          Z Offline
          zakkas2483
          wrote on last edited by
          #5

          Sorry,i was wrong. code is like that CEdit* clEdit = (CEdit*)getDlgItem( ID ); clEdit->SetFocus(); sorry again for mistake. Thanks. hiren thakkar

          S 1 Reply Last reply
          0
          • B bhogavalli suresh

            how do i set focus in one of my edit control in property sheet

            N Offline
            N Offline
            Nishad S
            wrote on last edited by
            #6

            GotoDlgCtrl( GetDlgItem( IDC_EDIT ));

            - NS -

            1 Reply Last reply
            0
            • B bhogavalli suresh

              how do i set focus in one of my edit control in property sheet

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #7

              Is this a trick question? The subject of your post should be a clue.


              "A good athlete is the result of a good and worthy opponent." - David Crow

              "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

              S 1 Reply Last reply
              0
              • B bhogavalli suresh

                how do i set focus in one of my edit control in property sheet

                M Offline
                M Offline
                Mark Salsbery
                wrote on last edited by
                #8

                To get more/better behavior than SetFocus() with edit controls, I would recommend CDialog::GotoDlgCtrl() (MFC) or WM_NEXTDLGCTL (Win32). (as stated by NS17) Mark

                Mark Salsbery Microsoft MVP - Visual C++ :java:

                1 Reply Last reply
                0
                • B bhogavalli suresh

                  how do i set focus in one of my edit control in property sheet

                  S Offline
                  S Offline
                  Stephen Hewitt
                  wrote on last edited by
                  #9

                  You shouldn't use SetFocus in dialogs. See here[^] for details.

                  Steve

                  1 Reply Last reply
                  0
                  • Z zakkas2483

                    Sorry,i was wrong. code is like that CEdit* clEdit = (CEdit*)getDlgItem( ID ); clEdit->SetFocus(); sorry again for mistake. Thanks. hiren thakkar

                    S Offline
                    S Offline
                    Stephen Hewitt
                    wrote on last edited by
                    #10

                    You shouldn't use SetFocus in dialogs. See here[^] for details.

                    Steve

                    Z 1 Reply Last reply
                    0
                    • S Sunil P V

                      Assume the ID of your edit control is IDC_EDIT_NAMETAG, to set the focus do the following: CWnd* pEditCtrl = GetDlgItem(IDC_EDIT_NAMETAG); pEditCtrl->SetFocus();

                      Sunil

                      S Offline
                      S Offline
                      Stephen Hewitt
                      wrote on last edited by
                      #11

                      You shouldn't use SetFocus in dialogs. See here[^] for details.

                      Steve

                      1 Reply Last reply
                      0
                      • S Stephen Hewitt

                        You shouldn't use SetFocus in dialogs. See here[^] for details.

                        Steve

                        Z Offline
                        Z Offline
                        zakkas2483
                        wrote on last edited by
                        #12

                        Thanks Steve ....Thank You very much

                        1 Reply Last reply
                        0
                        • D David Crow

                          Is this a trick question? The subject of your post should be a clue.


                          "A good athlete is the result of a good and worthy opponent." - David Crow

                          "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                          S Offline
                          S Offline
                          Stephen Hewitt
                          wrote on last edited by
                          #13

                          If it's a trick question it's a very tricky one -- you shouldn't use SetFocus in dialogs. See here[^] for details.

                          Steve

                          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