Solved

How to change a member variable in another dialog?

Posted on 2000-05-16
3
169 Views
Last Modified: 2010-04-02
In one dialog, I hope to change a member variable(it's type is CStringArray) in another dialog.(The two dialogs exist at the same time)
How to implement this?
0
Comment
Question by:Zhu051200
3 Comments
 

Expert Comment

by:gonugunta
ID: 2813471
what do you want to change - value or type
0
 
LVL 4

Accepted Solution

by:
abancroft earned 50 total points
ID: 2814647
Are these non-modal in the same application? If so, you could do this:

class CDialog1 : public CDialog
{
  // Missing stuff...

public
  CStringArray m_Str;
};

class CDialog2 : public CDialog
{
  // Missing stuff...

public
  CDialog1 *m_pDlg1;
};

CDialog1 dlg1;
CDialog2 dlg2;

dlg2.m_pDlg1 = &dlg1;

dlg1.Create();
dlg2.Create();

Now dlg2 has access to dlg1.m_Str through it's m_pDlg1 member. Obviously, it'd be a good idea to encapsulate the public members.
0
 

Author Comment

by:Zhu051200
ID: 2819759
thanks for your help!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now