Page 205 - DCAP408_WEB_PROGRAMMING
P. 205
Unit 12: Dialog Boxes (II)
The Member Variables tab lists the control IDs of the various controls. You can select an ID and Notes
click the Add Variable button to display the Add Member Variable dialog box (see Figure 12.2).
Figure 12.2: The Add Member Variable Dialog Box
You'll notice that the Add Member Variable dialog box lets you set a category that can be a value
or a control, as well as a variable type. The variable types available change depending on your
selection in the Category combo box.
If you set the Category combo box to indicate value mapping, the Variable Type combo box lists
member variable types that can be used with the type of control being mapped. These values are
great for quick and easy value-oriented transfer, but often you'll need to map a control class to
the control so that you can manipulate the control's more advanced features.
You can map a number of variables to the same control so that you can perform easy value
transfer and allow control handler class mapping concurrently.
After you add the member variable map, you'll notice that the new member variable is inserted
into your dialog box handler class definition between the ClassWizard AFX_DATA-generated
comments.
The new variable also initializes your dialog box class's constructor function like this:
//{{AFX_DATA_INIT(CCustomDlg)
m_strCustomEdit = _T("");
//}}AFX_DATA_INIT
You'll see a new entry placed in the DoDataExchange() function like this:
void CCustomDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCustomDlg)
DDX_Text(pDX, IDC_CUSTOM_EDIT, m_strCustomEdit);
//}}AFX_DATA_MAP
}
LOVELY PROFESSIONAL UNIVERSITY 199