Sign in to follow this  
tolaris

Win32: child dialog in a window and the Tab key

Recommended Posts

tolaris    288
Trying to get the application loop through all items in the 'parent' window *and* all items of embedded child dialog windows when the user presses the Tab key, like this: 1. focus on control_A in main window. <Tab> 2. focus on control_B in main window. <Tab> 3. focus on control_C in 'child' dialog. <Tab> 4. focus on control_D in 'child' dialog. <Tab> 5. focus on control_E in main window. <Tab> back to #1 but can't quite make it work... as soon as the focus enters the child dialog it never leaves it, but cycles just through the controls of child dialog (after step #4 jumps to #3 in the example above) the owner window has WS_EX_CONTROLPARENT extended style. controls in the owner window has the WS_TABSTOP style. the child dialogs have the DS_DIALOG and WS_EX_CONTROLPARENT styles set, controls in the dialog have their WS_TABSTOP as well. controls in the owner window and the dialogs are set as WS_CHILD with the owner window as parent. Looks like it should work... but it just doesn't :/ what am i missing here? ^^;;

Share this post


Link to post
Share on other sites
Evil Steve    2017
I assume you're trying to do some kind of settings page, like this:
DruinkIM Settings

In that, I create the main dialog with DialogBoxParam, and in WM_INITDIALOG I call CreateDialogParam() for each of the settings pages, setting the main window as the parent, use SetWindowPos(SWP_NOZORDER) to position the child window correctly
and then set the WS_EX_CONTROLPARENT syle with:

// Enable tab control //
LONG lOldStyle = GetWindowLong(m_hWnd,GWL_EXSTYLE);
SetWindowLong(m_hWnd,GWL_EXSTYLE,lOldStyle | WS_EX_CONTROLPARENT);
SetWindowPos (m_hWnd,NULL,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|
SWP_FRAMECHANGED);


Each of the settings pages has the WS_CHILD setting in the resource file, and has no border.

Hope this helps in some way.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
It's not a settings page actually, more of a cross between 3dmax-like rollup control and winXP explorer bar with some extra functionaliy thrown in here and there ^^ (used Johann Nadalutti's control as starting point)

If i put the child dialogs in a 'regular' modal dialog like in your example then it works just fine and like expected. The glitch occurs when the same dialogs are parented to this custom control though, so i guess something am doing in it is to blame. Will need to try giving it a friendly kick here and there >.<

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this