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. Tab order in win32 dialog

Tab order in win32 dialog

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestionlearning
5 Posts 3 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
    Melekor
    wrote on last edited by
    #1

    I have a modeless dialog box where I create all the controls myself in the WM_INITDIALOG message. My question is how to set the tab order of these controls. (Don't ask why I'm not creating them in the dialog resource :)) Thanks, Melekor

    M 1 Reply Last reply
    0
    • M Melekor

      I have a modeless dialog box where I create all the controls myself in the WM_INITDIALOG message. My question is how to set the tab order of these controls. (Don't ask why I'm not creating them in the dialog resource :)) Thanks, Melekor

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      The tab order is determined by the Z order of the controls. You'll need to use SetWindowPos() to position the controls after one another in the desired order. --Mike-- "So where does that leave us? Well, it leaves us right back where we started, only more confused than before." -- Matt Gullett Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber

      M 1 Reply Last reply
      0
      • M Michael Dunn

        The tab order is determined by the Z order of the controls. You'll need to use SetWindowPos() to position the controls after one another in the desired order. --Mike-- "So where does that leave us? Well, it leaves us right back where we started, only more confused than before." -- Matt Gullett Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber

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

        That sounds good, but I guess I don't know how to use it right because it's not working. I created this Inline void IncZOrder(HWND hWnd) { static HWND LastWindowCreated = 0; SetWindowPos(hWnd, LastWindowCreated, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); LastWindowCreated = hWnd; } now after I create every control, I call that function with its hWnd but it doesn't work, I still can't tab between the controls. I'm pretty sure my message pump is correct to handle dialogs: while(GetMessage(&msg, NULL, 0, 0) > 0) { HWND ActiveWindow = GetActiveWindow(); if(!IsWindow(ActiveWindow) || !IsDialogMessage(ActiveWindow, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } What else do I need to do? Thanks!

        N 1 Reply Last reply
        0
        • M Melekor

          That sounds good, but I guess I don't know how to use it right because it's not working. I created this Inline void IncZOrder(HWND hWnd) { static HWND LastWindowCreated = 0; SetWindowPos(hWnd, LastWindowCreated, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); LastWindowCreated = hWnd; } now after I create every control, I call that function with its hWnd but it doesn't work, I still can't tab between the controls. I'm pretty sure my message pump is correct to handle dialogs: while(GetMessage(&msg, NULL, 0, 0) > 0) { HWND ActiveWindow = GetActiveWindow(); if(!IsWindow(ActiveWindow) || !IsDialogMessage(ActiveWindow, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } What else do I need to do? Thanks!

          N Offline
          N Offline
          Neville Franks
          wrote on last edited by
          #4

          Are you setting the Tabstop Style for the controls you want to Tab between? Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com

          M 1 Reply Last reply
          0
          • N Neville Franks

            Are you setting the Tabstop Style for the controls you want to Tab between? Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com

            M Offline
            M Offline
            Melekor
            wrote on last edited by
            #5

            WS_TABSTOP! I didn't even know that style existed. Thank you Michael and Neville, with your two suggestions together, it is now working like a charm :-D

            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