
Multiple Level Dialog with Back, Next buttons
Quote:
> Hi!
> I'm trying to implement a multiple level dialog with Next, Back and
> Finish
> buttons at each level. Something like InstallShield.
> I'm having trouble navigating back and forth between levels.
> Let say there are two levels. Whenever I navigate back to the parent
> dialog (by means of CChildDlg::OnBack()), the parent dialog will get
> stuck
> and would not process any message.
> Am I totally off track? Can someone please point me to the right
> direction, some sample, etc.
> void CParentDlg::OnNext()
> {
> // Always hide itself first
> ShowWindow(SW_HIDE);
> // Then, show the child dlg if it's been created already
> if (m_pChildDlg != NULL){
> m_pChildDlg->ShowWindow(SW_SHOW);
> return;
> }
> // Create for the first time
> CChildDlg dlg;
> dlg.DoModal();
> // Save the child dlg ptr for the next OnNext event (see the
> second code
> block above)
> m_pChildDlg = &dlg;
> }
> void CChildDlg::OnBack()
> {
> // Always hide itself first
> ShowWindow(SW_HIDE);
> // Show it's parent dlg
> GetParent()->ShowWindow(SW_SHOW);
> }
> Thanks in advance!
> Wendy
Dear Wendy,
you are probably not on the right track...sorry,
the are two ways to invoke a dialog box - modal and modaless,
when you use a modal dialog, nothing else will be active untile the
dialog returns it's result to the calling thread, on the other hand,
when using a modaless dialog, you cvreate another thread (like the
find/replace dialog).
what's wrong with your code, is that as long as the child modal is
active(in modal state), the parent dialog does not get input. if you
want to remain using the modal state try this:
#define ID_BACK 0x8765 //user defined message
CParentDialog::OnNext()
{
CChildDlg dlg;
ShowWindow(SW_HIDE);
int result = dlg.DoModal();
ShowWindow(SW_SHOW);
if(result == ID_BACK) //did jony pressed the back button of the
child dialog?
{
}
else //do here whateven you want
{
}
Quote:
}
CChildDialog::OnBack()
{
EndModalLoop(ID_BACK);
Quote:
}
if there is something you didn't understand, just EMail me.
best
Ya'eer
http://www.israelkehat.com