CWnd::DoDataExchange

Called by the framework to exchange and validate dialog data.

virtual void DoDataExchange(
   CDataExchange* pDX 
);

Parameters

  • pDX
    A pointer to a CDataExchange object.

Remarks

Never call this function directly. It is called by the UpdateData member function. Call UpdateData to initialize a dialog box's controls or retrieve data from a dialog box.

When you derive an application-specific dialog class from CDialog, you need to override this member function if you wish to utilize the framework's automatic data exchange and validation. The Add Variable wizard will write an overridden version of this member function for you containing the desired "data map" of dialog data exchange (DDX) and validation (DDV) global function calls.

To automatically generate an overridden version of this member function, first create a dialog resource with the dialog editor, then derive an application-specific dialog class. Then use the Add Variable wizard to associate variables, data, and validation ranges with various controls in the new dialog box. The wizard then writes the overridden DoDataExchange, which contains a data map. The following is an example DDX/DDV code block generated by the Add Variable wizard:

void CPenWidthsDlg::DoDataExchange(CDataExchange* pDX)
{
   CDialog::DoDataExchange(pDX);
   DDX_Text(pDX, IDC_THINPENWIDTH, m_nThinWidth);
    DDV_MinMaxInt(pDX, m_nThinWidth, 1, 20);
   DDX_Text(pDX, IDC_THICKPENWIDTH, m_nThickWidth);
   DDV_MinMaxInt(pDX, m_nThickWidth, 1, 20);
}

The DoDataExchange overridden member function must precede the macro statements in your source file.

For more information on dialog data exchange and validation, see Displaying and Manipulating Data in a Form and Dialog Data Exchange and Validation. For a description of the DDX_ and DDV_ macros generated by the Add Variable wizard, see Technical Note 26.

Requirements

Header: afxwin.h

See Also

Concepts

CWnd Class

CWnd Members

Hierarchy Chart

CWnd::UpdateData