Click here to Skip to main content
15,888,401 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an MFC dialog which contains an embedded, borderless child dialog which itself contains some additional edit controls (similar to using frames in Visual Basic). While MFC manages the tab order of controls within the dialog itself, controls which are on the sub-dialog (frame) are not included in the tab order.

Is there an easy way to include the controls on the sub-dialog in the tab order?

What I have tried:

I have considered handling the Tab key and using SetFocus() but this might be an unnecessarily complicated approach.
Posted

You shouldn't need to hack around programatically to get this working. While I haven't done this in a while, I remember that I used to have to call ::SetParent to set the parent dialog, this including the child into the normal flow. Something like this
C++
::SetParent(m_embeddedDialog->GetSafeHwnd(), this->m_hWnd);
 
Share this answer
 
I may have found a solution...

First, using the resource editor, I set the "Control" and "Control Parent" properties of the child dialog to TRUE.

Then, when creating the child dialog, I used SetWindowPos() and set pWndInsertAfter to point to the control which is to precede the child dialog in the tab order.

This appears to work well.
 
Share this answer
 
Comments
Pete O'Hanlon 4-Apr-24 8:29am    
I'm pleased you found it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900