Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dialogs

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
If i have two different dialog boxes, what is the best way to let each dialog box access the same variable? e.i. A dialog box has a button, when you click it, it opens up another dialog box, and if i use GetWindowText to get the text of a edit box in that dialog, how can i let it be used by the first dialog?
 
Is it not possible to use the second CDialog object to access it edit box object variable (if defined as a member variable thru Class wizard) ?
 

I think it is Simple Try this

Say you have class CTestDialog

CTestDialog : public CDialog
{
public:
--
--
private:
CString m_StrTestValue;
}


CChildDialog : public CDialog
{
public:
CString m_strEditValue;
private:
CEdit m_EditCtrl;
..
....
....
}

if you do not want to use DDX then use GetWindowText.
CChildDialog:: OnSomeFunction()
{
m_EditCtrl.GetWindowText(m_strEditValue);
}

you can access
CTestDialog::OnButtonClick()
{
CChildDialog m_ChildDlg;
m_ChildDlg.DoModal();
m_StrTestValue = m_ChildDlg.m_strEditValue;
}


 
Look at my response in the question titled 'variables...'

Nyjil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top