how can i get a public member variable from View in a dialog

A SDI project based on CView,for example ,named Test;a public member variable named speed(int type) in TestView.cpp,the project include a dialog resource,the dialog called by menu.
IF i want to transfer a variable in dialog to Testview.cpp,i can do like this to get a int type variable:CDLG dlg;int a=dlg.variablename;
Now ,i want to transfer the variable:speed in the TestView.cpp to a variable in the dialog,how can i do?
[445 byte] By [mountainice] at [2007-11-20 11:51:05]
# 1 Re: how can i get a public member variable from View in a dialog
You can pass it to a dialog when is instantiated, before calling DoModal or Create.
Or you can obtain it later from a view.
You have to have some means to access a view object. Another words you have to have a pointer or a reference to the instance of the view.
For example:
- you can obtain pointer to a view from a dialog by calling framework or supplied functions.
- you can pass pointer to a view to a dialog when dialog is instantiated
Having pointer to an instance you will be able to access public members of that object.
JohnCz at 2007-11-11 4:02:33 >