Solved

share variables between CView and CDialog?

Posted on 1998-06-10
3
256 Views
Last Modified: 2013-11-20
how do i share a variable that is declared in the dialog class, with my cview class.  I need to do this because the variable is a member variable for a group of radio buttons in my dialog class.  Thanks
0
Comment
Question by:kclemans
3 Comments
 
LVL 1

Accepted Solution

by:
TAMC earned 50 total points
ID: 1317836
If you create your dialog with DoModal() try this

CYourDialog dlg;
if(dlg.DoModal()==IDOK)
{
     m_viewvairable = dlg.m_dialogvariable;
}
0
 
LVL 2

Expert Comment

by:kinkajou
ID: 1317837
The easiest thing is to make a global variable in you CView class .CPP file and use an extern in the dialog class .CPP file and place the value of the member variable in the shared variable. Example (which uses and int variable):

In CVIEW.CPP:

int ExampleVariable; // place at the top of the file under preprocessor definitions/#includes etc.


In DIALOG.CPP:

extern int ExampleVariable;// place at the top of the file under preprocessor definitions/#includes etc.
.
void DIALOGCLASS::SomeFunction ()
{
ExampleVariable = m_nMemberVariable; // m_nMemberVariable is a member variable of the DIALOGCLASS

}


0
 

Author Comment

by:kclemans
ID: 1317838
Thanks, it worked.  Enjoy the points.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Expand LInux Boot partition remotly 3 86
sumDigits challenge 9 125
no14 challenge 14 62
My project did see openJDK that I installed. What could be the problem 7 124
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

861 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

24 Experts available now in Live!

Get 1:1 Help Now