In my program i am invoking the same dialogbox for four different Items. So depending on the
item i want to change the Title . how can i do it?
Printable View
In my program i am invoking the same dialogbox for four different Items. So depending on the
item i want to change the Title . how can i do it?
Hi.
this->SetWindowText("Your Title");
Or we can omit this.
So, SetWindowText("Your Title");
Hope for help.
-Masaaki Onishi-
the dialogbox is invoked from Mainframe.
so i can't use this->.
void CMainFrame::OnChangeGroup()
{
CSetUpDlg tDlg;
tDlg.DoModal();
}
void CMainFrame::OnChangePhase()
{
CSetUpDlg tDlg;
tDlg.DoModal();
}
tDlg.SetWindowText() gives some assertion failure.
i got it.
i can do it on OnInitDialog() ;
thanks for your help.
Viju
In that case do the following procedure.
for example, CInvoker is a dialog invoking a InvokedDlg whose title is
supposed to be changed.
CInvoker::Test1()
{
CInvokedDlg InvokedDlg;
// key position before DoModal()
InvokedDlg.GetTitle("Title that I want to change");
if(InvokerDlg.DoModal() == IDOK)
{
...
}
}
-----------------
class CInvokedDlg : public CDialog
{
...
private:
CString m_pTitle;
...
}
CInvokedDlg::CInvokedDlg(Wnd* pParent.....) // constructer
{
// insert the following line.
m_pTitle = _T("");
}
void CInvokedDlg::GetTitle(CString szTitle)
{
m_pTitle = szTitle;
}
BOOL CAlertDlg::OnInitDialog()
{
CDialog::OnInitDialog();
SetWindowText(m_pTitle); // insert to change the title
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
P.S.: 4 hours has passed to know this solution. ^)^