Dynamically create an edit control in the View class as follows:
Editt1.create (es_multiline
| Ws_child | ws_visible | ws_tabstop |
Ws_border, crect (0, 0, 50, 20), this, idc_editt1 );
Now you want to implement the data exchange function in a similar dialog box.
My method is:
Void cmatlab printview: dodataexchange (cdataexchange * PDX)
{
// Todo: add your specialized code here and/or call the base class
Cview: dodataexchange (PDX );
// {Afx_data_map (cmatlab printview)
Ddx_text (PDX, idc_editt1, m_dt1 );
//} Afx_data_map
}
When you run dodataexchange, your edit box is not generated yet. Of course, idc_editt1 and m_dt1 cannot be associated.
_____________________________________________________________________________
I agree, so my approach is:
Add:
Editt1 = new cedit (); // Add this statement
Editt1-> Create (es_multiline | ws_child | ws_visible
| Ws_tabstop | ws_border, crect (0, 0, 50, 20), this, idc_editt1 );
A global control variable named at the beginning of the function: cedit * editt1;
Use editt1 to process the edit in other parts of the function, for example, editt1-> setwindowtext ("edit ");
Idc_editt1 is the custom resource ID
VCProgramResource definition. The following number is only used to indicate specific resources and avoid duplication. The specific value does not make sense.
#DefineIdd_aboutbox 100 indicates that there is a dialog box resource with ID idd_aboutbox.