Going right to a subdialog
-
In certain situations I want to go right to a dialog after loading a dialog, and I'm wondering how to do this such that the parent dialog is drawn on screen first. For instance, I have dialog A with a button which, when clicked, loads another dialog B. In certain situations I want to pop up this child dialog B right away, as though the user clicked the button. If I set to true a member variable in dialog A, m_bPopupBRightAway, before calling DialogA::DoModal() and check this value at the end of DialogA::OnInitDialog(), dialog A isn't yet drawn on the screen when DialogB comes up. What's the best way to go about doing this so that I get the desired result? Thanks! - Jason (SonorkID 100.611) In the beginning, teachers taught the 5 W's: who, what, where, when, why. Now it's just a big damn G
-
In certain situations I want to go right to a dialog after loading a dialog, and I'm wondering how to do this such that the parent dialog is drawn on screen first. For instance, I have dialog A with a button which, when clicked, loads another dialog B. In certain situations I want to pop up this child dialog B right away, as though the user clicked the button. If I set to true a member variable in dialog A, m_bPopupBRightAway, before calling DialogA::DoModal() and check this value at the end of DialogA::OnInitDialog(), dialog A isn't yet drawn on the screen when DialogB comes up. What's the best way to go about doing this so that I get the desired result? Thanks! - Jason (SonorkID 100.611) In the beginning, teachers taught the 5 W's: who, what, where, when, why. Now it's just a big damn G
void CMyDlg::OnPaint()
{
if (IsIconic())
{
...
}
else
{
CDialog::OnPaint();
if(m_bFirstTime){
m_bFirstTime=FALSE;
... // launch the second dialog.
}
}
}Where
m_bFirstTime
is a member variable of the dialog initialized toTRUE
. Another method, suggested by Shog9, is to self-post a user-defined message fromOnInitDialog
in response to which the second dialog is launched. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo -
void CMyDlg::OnPaint()
{
if (IsIconic())
{
...
}
else
{
CDialog::OnPaint();
if(m_bFirstTime){
m_bFirstTime=FALSE;
... // launch the second dialog.
}
}
}Where
m_bFirstTime
is a member variable of the dialog initialized toTRUE
. Another method, suggested by Shog9, is to self-post a user-defined message fromOnInitDialog
in response to which the second dialog is launched. Joaquín M López Muñoz Telefónica, Investigación y DesarrolloJoaquín M López Muñoz wrote: Another method, suggested by Shog9, is to self-post a user-defined message from OnInitDialog in response to which the second dialog is launched. Ooh, I like it. Thanks a lot! - Jason (SonorkID 100.611) In the beginning, teachers taught the 5 W's: who, what, where, when, why. Now it's just a big damn G