Re: Parent to Child Dialog Data Transfer & Vise Versa in VC++
After DoModal returns neiter a dilog window nor controls in it more exist. So you cannot access them anymore.
Instead you have to set all the data from the controls to the dialog data variables (strings, numbers, some class or struct objects and so on). You must do it before the dialog OnOk() method returns.
Then you'll be able to access this data from the parent after DoModal returns.
Re: Parent to Child Dialog Data Transfer & Vise Versa in VC++
Originally Posted by saraswathisrinath
but my requirement is,single modeless parent & child dialog. both are in open condition.
If i change the value in parent it will update in child & vies verse.
So do you want a modal or modeless dialog? If the child dialog should be modeless, then why does it have OK and Cancel buttons? I think you should explain better what you want.
Also, why did you implement message handlers for the OK and Cancel buttons in CChildDlg? CDialog already has virtual functions OnOK and OnCancel that are called by the framework (also when the user presses the Enter or Esc key).
Cheers, D Drmmr
Please put [code][/code] tags around your code to preserve indentation and make it more readable.
As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky
Re: Parent to Child Dialog Data Transfer & Vise Versa in VC++
Hi D_Drmmr,
sorry for the late reply, I want modeless dialog.
sorry i wrote the function like send data from child dialog to parent dialog in the default CANCEL
button, and also didn't remove the OK button.
My Requirement:
***************************
I'm using MSComm control in my parent dialog for serial communication.
Using this, I send/received the data at every sec from my parent dialog.
now, I display the particular edit control value from parent to child dialog,
and also change the value from child's child screen to parent & child dialog.
Ex:
Parent ---------------------Child ------------> Modeless dialog
Current = 100 -----------Current = 100 -----------> It display the parent value only.
Child------------------------Child's child -----------> Model dialog
Current = 100------------Current = 100 -----------> If i change the child's child dialog, the value
must change in the parent dialog and the above condition the parent value shown in the
modeless child dialog. Child's child current value = 150, then parent & child current value = 150.
Last edited by saraswathisrinath; December 2nd, 2012 at 11:04 PM.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.