Modeless Dialogs
-
Hi, I did a search on how to create a modeless dialog window and got some great things. I did follow one of the articles on how to do this, and it worked great for dialogs that pop up when choosing it from a menu. However, I also want to do the same thing when I click on an "OK" button of a modal dialog. Basically I want to close the modal and have the modeless dialog come up. I am using the code:
void CSendTo::OnOK() { //CDialog::OnOK(); if (!m_pCommandOpt) m_pCommandOpt = new CMainCommand; if (!::IsWindow(m_pCommandOpt->GetSafeHwnd())) m_pCommandOpt->Create(IDD_MAIN_TAB_DIALOG, this); m_pCommandOpt->ShowWindow(SW_SHOWNORMAL); //CDialog::OnOK(); }
If I remove the either of the comments in front of CDialog::OnOK() it closes both windows and only flashes the modeless window for a second on screen. If I leave it commented out it keeps the modal window on screen and pops up the second window which seems to be MODAL. If i close the second window the first window is still there MUCH THANKS IN ADVANCE!!!! -
Hi, I did a search on how to create a modeless dialog window and got some great things. I did follow one of the articles on how to do this, and it worked great for dialogs that pop up when choosing it from a menu. However, I also want to do the same thing when I click on an "OK" button of a modal dialog. Basically I want to close the modal and have the modeless dialog come up. I am using the code:
void CSendTo::OnOK() { //CDialog::OnOK(); if (!m_pCommandOpt) m_pCommandOpt = new CMainCommand; if (!::IsWindow(m_pCommandOpt->GetSafeHwnd())) m_pCommandOpt->Create(IDD_MAIN_TAB_DIALOG, this); m_pCommandOpt->ShowWindow(SW_SHOWNORMAL); //CDialog::OnOK(); }
If I remove the either of the comments in front of CDialog::OnOK() it closes both windows and only flashes the modeless window for a second on screen. If I leave it commented out it keeps the modal window on screen and pops up the second window which seems to be MODAL. If i close the second window the first window is still there MUCH THANKS IN ADVANCE!!!! -
Hi, I did a search on how to create a modeless dialog window and got some great things. I did follow one of the articles on how to do this, and it worked great for dialogs that pop up when choosing it from a menu. However, I also want to do the same thing when I click on an "OK" button of a modal dialog. Basically I want to close the modal and have the modeless dialog come up. I am using the code:
void CSendTo::OnOK() { //CDialog::OnOK(); if (!m_pCommandOpt) m_pCommandOpt = new CMainCommand; if (!::IsWindow(m_pCommandOpt->GetSafeHwnd())) m_pCommandOpt->Create(IDD_MAIN_TAB_DIALOG, this); m_pCommandOpt->ShowWindow(SW_SHOWNORMAL); //CDialog::OnOK(); }
If I remove the either of the comments in front of CDialog::OnOK() it closes both windows and only flashes the modeless window for a second on screen. If I leave it commented out it keeps the modal window on screen and pops up the second window which seems to be MODAL. If i close the second window the first window is still there MUCH THANKS IN ADVANCE!!!!I've never tried anything like this but so my suggestion may be way off. Perhaps the issue lies in the call to Create(). By specifying a parent, the child dialog goes away as soon as its parent goes away. Remove the 'this' parameter and note the results.
-
I've never tried anything like this but so my suggestion may be way off. Perhaps the issue lies in the call to Create(). By specifying a parent, the child dialog goes away as soon as its parent goes away. Remove the 'this' parameter and note the results.