to create CDialog with completed forms
-
I'd like to create dialog box with completed fields... write smth like this class CDlg:public CDialog{ public: CDlg(UINT nRes, CWnd *pParent,int nIndx=-1); DECLARE_MESSAGE_MAP() afx_msg void OnOk(); }; CDlg::CDlg(UINT nRes, CWnd *pParent, int nIndx) : CDialog(nRes, pParent) { if(nIndx!=-1){ CPerson* pers=(CPerson*)ob_arr[nIndx]; AfxMessageBox(pers->GetName());//check is there access to CPerson's functions ... it's OK SetDlgItemText (IDC_EDIT2,_T("1111111")/*pers->GetName()*/);//error in winocc.cpp line:156 } }
-
I'd like to create dialog box with completed fields... write smth like this class CDlg:public CDialog{ public: CDlg(UINT nRes, CWnd *pParent,int nIndx=-1); DECLARE_MESSAGE_MAP() afx_msg void OnOk(); }; CDlg::CDlg(UINT nRes, CWnd *pParent, int nIndx) : CDialog(nRes, pParent) { if(nIndx!=-1){ CPerson* pers=(CPerson*)ob_arr[nIndx]; AfxMessageBox(pers->GetName());//check is there access to CPerson's functions ... it's OK SetDlgItemText (IDC_EDIT2,_T("1111111")/*pers->GetName()*/);//error in winocc.cpp line:156 } }
NoName II wrote:
CDlg::CDlg(UINT nRes, CWnd *pParent, int nIndx) : CDialog(nRes, pParent) { if(nIndx!=-1){ CPerson* pers=(CPerson*)ob_arr[nIndx]; AfxMessageBox(pers->GetName());//check is there access to CPerson's functions ... it's OK SetDlgItemText (IDC_EDIT2,_T("1111111")/*pers->GetName()*/);//error in winocc.cpp line:156 }
Do the initialization part in
OnInitDialog
. Do not do this in the construtor.
Nibu thomas Software Developer CPP Faqs by Michael dunn
-
NoName II wrote:
CDlg::CDlg(UINT nRes, CWnd *pParent, int nIndx) : CDialog(nRes, pParent) { if(nIndx!=-1){ CPerson* pers=(CPerson*)ob_arr[nIndx]; AfxMessageBox(pers->GetName());//check is there access to CPerson's functions ... it's OK SetDlgItemText (IDC_EDIT2,_T("1111111")/*pers->GetName()*/);//error in winocc.cpp line:156 }
Do the initialization part in
OnInitDialog
. Do not do this in the construtor.
Nibu thomas Software Developer CPP Faqs by Michael dunn
-
Use an
Init
function for these kind of initialization purposes.NoName II wrote:
how can I send nIndx in OnInitDialog?
Store the
nIndx
as a member variable or store theperson object
as a member variable of the dialog class.
Nibu thomas Software Developer Faqs by Michael dunn
-
Use an
Init
function for these kind of initialization purposes.NoName II wrote:
how can I send nIndx in OnInitDialog?
Store the
nIndx
as a member variable or store theperson object
as a member variable of the dialog class.
Nibu thomas Software Developer Faqs by Michael dunn