Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

moving data between dialogs

Posted on 1999-07-27
4
Medium Priority
?
238 Views
Last Modified: 2012-05-04
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.
Thanks,
0
Comment
Question by:Argonauts
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 4

Expert Comment

by:mandhjo
ID: 1201178
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?
0
 
LVL 23

Expert Comment

by:naveenkohli
ID: 1201179
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..
0
 
LVL 6

Accepted Solution

by:
Triskelion earned 400 total points
ID: 1201180
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())
      {
      return;
      }

   dlgTwo.SetValueOne(dlgOne.GetValueOne());
   dlgTwo.SetValueSeven(dlgOne.GetValueSeven());
   dlgTwo.SetName(dlgOne.m_strName);
   dlgTwo.DoModal();
}
0
 
LVL 1

Author Comment

by:Argonauts
ID: 1201181
Excelent,
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.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question