• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 241
  • Last Modified:

moving data between dialogs

I am attempting to use the user choices on a previous dialog to determine what controls are available on the next dialog screen. My if statement "m_Win95==TRUE" reports the m_Win95 as undeclared identifier.  (It is declare on the previous IDD_OPE_DLG but not in the new one IDD_OPEStep_DLG.)  This is probably a lame question but how do I make it remember the value from the previous dialog?  I am going to try to insert as an invisible component but I think that I am missing the easy way to do this.
1 Solution
Do you have a function that calls the dialogs in order or does each dialog call another one?

I think the easiest way is to add parameters in the constructors of the dialogs.  The parameters would indicate what should be displayed on the dialog.

For example,

1. create dialog1
2. show dialog1.
3. When dialog one is done and before you blow it away, get from it the values you need to congifure dialog2
4. create dialog2 passing the configuration values
5. show dialog2
6. etc

Does that make sense?
You can accomplish it number of ways...
1. Pass that value or set of values as constructor arguments to new dialog box class.
2. If there are lots of variales then you can consider passing the pointer to prev. dialog box to next dialog and have accessor functions in prev dialog box to access these variables.

This was in OnInitDialog function you can show/hide controls based on these vlues..
I will try to clarify this a bit so it does not seem like I'm poaching.

In the class for the first dialog (we'll call it dlgOne), create member variables and functions that return the values you're looking for dlgOne.  The dialog does not need to be visible for you to run its functions.  First display the dialog and have the user set the configuration.  After the user presses OK and before the calling function or dialog class instance goes out of scope, call the functions that get you the expected values.  
Your other dialog class instance dlgTwo will be able to use the values before you call DoModal();

   CMyDialog   dlgOne;
   CYourDialog dlgTwo;
   if (IDOK != dlgOne.DoModal())

ArgonautsAuthor Commented:
I knew what I needed to do but could not figure how to do it.  In some cases VB is a lot easier.
Thanks to all who responded.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now