Child Dialog Box
-
If I have a main dialog box, and On the click of a button I want a child dialog box to appear...what do I do? I created a dialog box (with type child) and in the BNClicked method of the button I wrote. void CMainDlg::OnAddChild() { CChildDlg* ChildBox = new CChildDlg; ChildBox->DoModal(); } But the images of the Main and the Child dialog boxes got superimposed (and got mixed up) during runtime. So someone suggested the following, but it still does not work! void CMainDlg::OnAddChild() { CChildDlg* ChildBox = new CChildDlg; if(!::IsWindow(GetSafeHwnd())) ChildBox->Create(IDD_AJOUT, this); ChildBox->ShowWindow(SW_SHOW); } Please tell me how do I get my child dialog box to show properly?
-
If I have a main dialog box, and On the click of a button I want a child dialog box to appear...what do I do? I created a dialog box (with type child) and in the BNClicked method of the button I wrote. void CMainDlg::OnAddChild() { CChildDlg* ChildBox = new CChildDlg; ChildBox->DoModal(); } But the images of the Main and the Child dialog boxes got superimposed (and got mixed up) during runtime. So someone suggested the following, but it still does not work! void CMainDlg::OnAddChild() { CChildDlg* ChildBox = new CChildDlg; if(!::IsWindow(GetSafeHwnd())) ChildBox->Create(IDD_AJOUT, this); ChildBox->ShowWindow(SW_SHOW); } Please tell me how do I get my child dialog box to show properly?
That's because you made it a type child, which means embedded in it's parent as opposed to a seperate dialog box. The suggestion you got was idiotic - it creates a modeless dialog and assumes it deletes itself ( because it's a pointer it won't die when it goes out of scope, nor do you have the address to interact with it or clean it up ) Christian After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001