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. How to Set Tab order for dynamically created controls like CButton,CEdit

How to Set Tab order for dynamically created controls like CButton,CEdit

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
6 Posts 5 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.
  • A Offline
    A Offline
    Abhijit D Babar
    wrote on last edited by
    #1

    Hello all, I created a window. Over that window i created some controls of the class CButton, CEdit,CStatic, CComboBox. My problem is that, i have to assign the tab order for this controls. I set the WS_TABSTOP property while creating this controls. But tab order is not set for this controls. How can i set tab order for this controls. ******************** CEdit* pedtName = new CEdit(); pedtName->Create(ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_TABSTOP,CRect(160,140,300,170) ,this,EDITNAME);

    N S _ H 4 Replies Last reply
    0
    • A Abhijit D Babar

      Hello all, I created a window. Over that window i created some controls of the class CButton, CEdit,CStatic, CComboBox. My problem is that, i have to assign the tab order for this controls. I set the WS_TABSTOP property while creating this controls. But tab order is not set for this controls. How can i set tab order for this controls. ******************** CEdit* pedtName = new CEdit(); pedtName->Create(ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_TABSTOP,CRect(160,140,300,170) ,this,EDITNAME);

      N Offline
      N Offline
      nitin3
      wrote on last edited by
      #2

      use pedtName->SetWindowPos(...) see the first parameter of SetWindowsPos

      A 1 Reply Last reply
      0
      • A Abhijit D Babar

        Hello all, I created a window. Over that window i created some controls of the class CButton, CEdit,CStatic, CComboBox. My problem is that, i have to assign the tab order for this controls. I set the WS_TABSTOP property while creating this controls. But tab order is not set for this controls. How can i set tab order for this controls. ******************** CEdit* pedtName = new CEdit(); pedtName->Create(ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_TABSTOP,CRect(160,140,300,170) ,this,EDITNAME);

        S Offline
        S Offline
        SandipG
        wrote on last edited by
        #3

        As other reply says you can use SetWindowPos for altering tab order. You can also check here[^].. I hope it helps.

        Regards, Sandip.

        1 Reply Last reply
        0
        • N nitin3

          use pedtName->SetWindowPos(...) see the first parameter of SetWindowsPos

          A Offline
          A Offline
          Abhijit D Babar
          wrote on last edited by
          #4

          Sorry sir, it doesn't work. I created two edit control as follows on the OnCreate() method of the application. ************** CEdit* pedtName = new CEdit(); pedtName->Create(ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER,CRect(160,100,300,130) ,this,EDITNAME); pedtName->SetFont(pFont,TRUE); CEdit* pedtSurName = new CEdit(); pedtSurName->Create(ES_AUTOVSCROLL | ES_AUTOHSCROLL |ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER,CRect(160,140,300,170) ,this,EDITSURNAME); ***************** When i run the application, focus will automatically set to pedtName control. When i press tab key, tab focus will set on pedtSurName. But now it doesn't work. How to do this?

          1 Reply Last reply
          0
          • A Abhijit D Babar

            Hello all, I created a window. Over that window i created some controls of the class CButton, CEdit,CStatic, CComboBox. My problem is that, i have to assign the tab order for this controls. I set the WS_TABSTOP property while creating this controls. But tab order is not set for this controls. How can i set tab order for this controls. ******************** CEdit* pedtName = new CEdit(); pedtName->Create(ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_TABSTOP,CRect(160,140,300,170) ,this,EDITNAME);

            _ Offline
            _ Offline
            _Superman_
            wrote on last edited by
            #5

            Why don't you simply create the controls in the order that you want.

            «_Superman_»

            1 Reply Last reply
            0
            • A Abhijit D Babar

              Hello all, I created a window. Over that window i created some controls of the class CButton, CEdit,CStatic, CComboBox. My problem is that, i have to assign the tab order for this controls. I set the WS_TABSTOP property while creating this controls. But tab order is not set for this controls. How can i set tab order for this controls. ******************** CEdit* pedtName = new CEdit(); pedtName->Create(ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_TABSTOP,CRect(160,140,300,170) ,this,EDITNAME);

              H Offline
              H Offline
              Hamid Taebi
              wrote on last edited by
              #6

              If you want to set Tab Order on the dialog forum you must be press Ctrl+D or runtime liek this: CWnd *m_pWnd1 = GetDlgItem (IDC_BUTTON1); CWnd *m_pWnd2 = GetDlgItem (IDC_EDIT2); m_pWnd1->SetWindowPos (m_pWnd2, 0,0,0,0, SWP_NOMOVE | SWPNOSIZE);

              Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )

              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