simple serveral dialog flipping mfc application

michaelh20

Senior member
Sep 4, 2000
482
0
0
I was thinking of having a simple application where at several points the active window would change from dialog to another, sort of like Cformview. Sort of like a SDI program but when the user chooses to do a different sort of category of activity, I can flip to the relevant dialog (that I have stored as a resource), capture activities and then when the user does something different flip it back again. Note that this would not exactly be different views of the same document, which I know you can change, but I would like to just be able to programmatically flip a switch and change what the user sees on the window. I could use, but don't have to and kind of don't want to use the Doc/View thing, mostly because I don't think I really have to. I can even do the "Dialog Based App" thingee and I think that might be sufficent, but how can I change and or embed the Windows/Dialogs in each other?

Thanks for any suggestions.
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
A "cheating" way would be to have a while loop that creates them instead of flipping them, and store the common data in a struct or class attached to the App class,

// put this in the initinstance of the app class

m_ dialog_number = 1 ; // global NOT LOCAL

do {

if ( m_dialog_number == 1 )
{
CDlgOne d1 ;
d1.DoModal() ;
}
else if ( m_dialog_number == 2 )
{
CDlgTwo d2 ;
d2.DoModal() ;
}
// more as needed

} while ( m_dialog_number > 0 ) ;

When you want to switch, in the dialog you get a pApp pointer, set m_dialog_number, call CDialog :: OnOK () ;