Tab order in win32 dialog
-
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
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 -
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 | 1ClickPicGrabberThat 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! -
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!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
-
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