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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieving Dialog Controls?

Status
Not open for further replies.

golyg

Programmer
Jul 22, 2002
319
US
Hi all,
I am trying to determine in dialog A if a control on dialog B is empty. Is this possible and how would I do this?

TIA,
M
 
If you can do this depends a bit upon your code structure.
You could do it this way (but I'm not sure):
///////////////////////////////////////////////////////
CYourFirstDlg: public CDialog
{
//initialisation
CDialog* pSecondDlg; //CDialog because the code does not know CYourSecondDialog by now.
//But CDialog will usually be good enough
BOOL IsOtherControlEmpty(if(pSecondDlg->GetDlgItemText(ID_NAME)/*or ItemInt*/== _T(""))return FALSE;}//should not be inline

}

CYourSecondDlg: public CDialog
{
//initialisation
CYourFirstDlg* pFirstDlg;
/*IsOtherControlEmpty can be used just like in the first dialog, but here you have the exact dialog from your template; this means you can access your control variables after updating, like pFirstDlg->UpdateData(); if(pFirstDlg->m_controlVar.IsEmpty()) return FALSE;*/
}

CYourDocument: public CDocument
{
//initialisation
CYourFirstDlg* dlgA;//init in your constructor (new CYourFirstDlg() etc.)
CYourSecondDlg* dlgB;//init in your constructor
void InitDlgs(dlgA->pSecondDlg= (CDialog*) dlgB; dlgB->pFirstDlg= dlgA;};//call this after you have created the dialogs on the heap
};
////////////////////////////////////////////////////////
I hope this is what you wanted to know and that it works and helped
 
Besides: I know the code is not written, as a code should be written (everything public etc.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top