I in the VC using MFC to do a dialog box, it can receive data (float type), I now want to use in another class the received data to do in this dialog, a great god help solve, can post code is better
CodePudding user response:
That sends a dialog box to add a variable m_float,
Accept the class take m_float after Domodal returns
CodePudding user response:
reference 1st floor schlafenhamster response: that send a dialog box to add a variable m_float, Take classes in Domodal return after m_float I did before, but the received data in the other classes don't call, CodePudding user response:
Accept class after Domodal return take m_float immediately CodePudding user response:
Add a variable m_float, is can't control, because Domodal returned after the window has been destroyed CodePudding user response:
reference 1st floor schlafenhamster response: that send a dialog box to add a variable m_float, Take classes in Domodal return after m_float When calling this variable shows undefined, the error C2065: 'm_ct_R: undeclared identifier CodePudding user response:
reference 4 floor schlafenhamster response: add a variable m_float, is can't control, because Domodal returned after the window has been destroyed That is to say, I have the receipt within the dialog box to assign a value to a variable, but this is under the OnButton function, I think is because is m_ct_R assigned to variables within the function, and then after the function exits, disappeared, Void CLJQ_CT: : OnButton1 () { The UpdateData (); M_ct_R=m_ct_R; } CodePudding user response:
Public: Float m_float; CodePudding user response:
Void CAboutDlg: : OnOK () { //TODO: Add extra validation here M_Float=(float) 4.14; (try) CDialog: : OnOK (); } ///////////////////////////////////////////////////////////////////// CAboutDlg dlgAbout; DlgAbout. DoModal (); Float ret=dlgAbout. M_Float; AfxDump & lt; /////////////////////////////////////////////////////////////////// Public: CAboutDlg (); Float m_Float; CodePudding user response:
Upstairs is a warm-hearted man CodePudding user response:
Not yet, you can contact me, CodePudding user response:
You can try: set as global variables CodePudding user response:
Postmessage! CodePudding user response:
Do a message, receives the data message backwardness past send data Or put the data in the app class Shared out Refer to http://download.csdn.net/download/xianglitian/2383423 This example USES the method