What's the right way to show a non-modal child dialog in MFC (VS2005)?
        Posted  
        
            by John
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by John
        
        
        
        Published on 2010-04-14T11:05:15Z
        Indexed on 
            2010/04/14
            12:43 UTC
        
        
        Read the original article
        Hit count: 205
        
mfc
Rather than have everything in one big dialog, I'm looking at being able to display child dialogs for separate groups of controls. The idea is these are not free-floating child dialogs like floating toolbars, but would be shown with no title-bar, their position locked to the parent dialog... so as you drag the parent dialog any open child is dragged too.
NOTE: these child windows are not inside the parent dialog, they would typically be 'glued' to the edge of it.
In MFC/VC++ 2005, what's the best way to do this? For testing, I currently have a standard MFC Dialog-based app setup with CMainDlg, and I've then created a 'widget dialog' CWidgetDlg. So far I've got a member variable CWidgetDlg MainDlg::m_Widget and a button on CMainDlg with a handler like
CMainDlg::OnDisplayWidgetBtn()
{
 m_Widget.ShowWindow(TRUE);
}
But of course m_Widget hasn't got a HWND setup, and I am trying to remember the right way to do this? For dialog controls I can use DDX but what about child dialogs?
And is this a reasonable approach, or is there a nicer, more automated way?
© Stack Overflow or respective owner