CDialog
-
Hi, I have created a modal dialogbox and attached a button and named it as Save. Whenever I clicked on it I want to display another dialogbox with a combo box attached to it.Whenever I clicked on OK button I need to get the data in the first Dialog box. void CDialogClass1:OnSave() { CDialog2 dlg2; dlg2.DoModal();//I attached a combo box to it. } Please can u help me. Thanks in advance.
-
Hi, I have created a modal dialogbox and attached a button and named it as Save. Whenever I clicked on it I want to display another dialogbox with a combo box attached to it.Whenever I clicked on OK button I need to get the data in the first Dialog box. void CDialogClass1:OnSave() { CDialog2 dlg2; dlg2.DoModal();//I attached a combo box to it. } Please can u help me. Thanks in advance.
U can pass parameter from First Dialog to second dialg 1 ) through constructor 2) Via member variable ( CDialog2 dlg2; dlg2.m_Var = m_Var_one dlg2.DoModal();//I attached a combo box to it. 3) Keep a global variable and share value in two dialog
-
U can pass parameter from First Dialog to second dialg 1 ) through constructor 2) Via member variable ( CDialog2 dlg2; dlg2.m_Var = m_Var_one dlg2.DoModal();//I attached a combo box to it. 3) Keep a global variable and share value in two dialog
I am very sorry.I can't understand what u said. I need not want to send data from first dialogbox to the second dialogbox which contains the combobox. I want from the data from second dialog's combobox. Thanks for u r effort.
-
Hi, I have created a modal dialogbox and attached a button and named it as Save. Whenever I clicked on it I want to display another dialogbox with a combo box attached to it.Whenever I clicked on OK button I need to get the data in the first Dialog box. void CDialogClass1:OnSave() { CDialog2 dlg2; dlg2.DoModal();//I attached a combo box to it. } Please can u help me. Thanks in advance.
vc++_fragrance wrote:
display another dialogbox with a combo box attached to it.Whenever I clicked on OK button I need to get the data in the first Dialog box.
There are two ways to this in my knowledge: 1) If it's a base/derived relationship you can use GetParent() to get a pointer of the parent class in the derived class and then use it to access the member functions of the parent class and also the member variables depending on their access modifiers. 2) You can create a pointer of the first class(From where you are calling DoModal()) into the second class where you need the contents of the first dialog. For this: a) Include the header file of the first dialog in the second. b) In the public section declare a pointer of the first class. Like: CMyFirstClass *pFirstClass; c) Just above the line dlg2.DoModal() you can write dlg2.pFirstClass=this; d) Now you can access the variables/members/member functions of the first dialog in the second dialog using pFirstClass. Like: pFirstClass->m_strEdit.GetWindowText(...); etc....
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
-
vc++_fragrance wrote:
display another dialogbox with a combo box attached to it.Whenever I clicked on OK button I need to get the data in the first Dialog box.
There are two ways to this in my knowledge: 1) If it's a base/derived relationship you can use GetParent() to get a pointer of the parent class in the derived class and then use it to access the member functions of the parent class and also the member variables depending on their access modifiers. 2) You can create a pointer of the first class(From where you are calling DoModal()) into the second class where you need the contents of the first dialog. For this: a) Include the header file of the first dialog in the second. b) In the public section declare a pointer of the first class. Like: CMyFirstClass *pFirstClass; c) Just above the line dlg2.DoModal() you can write dlg2.pFirstClass=this; d) Now you can access the variables/members/member functions of the first dialog in the second dialog using pFirstClass. Like: pFirstClass->m_strEdit.GetWindowText(...); etc....
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
Thank you very much.
-
I am very sorry.I can't understand what u said. I need not want to send data from first dialogbox to the second dialogbox which contains the combobox. I want from the data from second dialog's combobox. Thanks for u r effort.
IF you want the data from the second dialog box in the first one: you can do this: if(dlg2.DoModal()==IDOK) { dlg2.m_myCombo.// Some function to retrieve data from combo box } :omg: -- modified at 9:03 Tuesday 26th September, 2006
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
-
IF you want the data from the second dialog box in the first one: you can do this: if(dlg2.DoModal()==IDOK) { dlg2.m_myCombo.// Some function to retrieve data from combo box } :omg: -- modified at 9:03 Tuesday 26th September, 2006
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
_AnShUmAn_ wrote:
dlg2.m_myCombo.// Some function to retrieve data from combo box
Not possible, as the combobox no longer exists.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
-
Hi, I have created a modal dialogbox and attached a button and named it as Save. Whenever I clicked on it I want to display another dialogbox with a combo box attached to it.Whenever I clicked on OK button I need to get the data in the first Dialog box. void CDialogClass1:OnSave() { CDialog2 dlg2; dlg2.DoModal();//I attached a combo box to it. } Please can u help me. Thanks in advance.
if your main class is CMainDlg you can use CMainDlg* m_Main=(CMainDlg*)GetParent(); m_Main->YouCombo();
WhiteSky