CDataExchange Class

Supports the dialog data exchange (DDX) and dialog data validation (DDV) routines used by the Microsoft Foundation classes.

class CDataExchange

Name

Description

CDataExchange::CDataExchange

Constructs a CDataExchange object.

Name

Description

CDataExchange::Fail

Called when validation fails. Resets focus to the previous control and throws an exception.

CDataExchange::PrepareCtrl

Prepares the specified control for data exchange or validation. Use for nonedit controls.

CDataExchange::PrepareEditCtrl

Prepares the specified edit control for data exchange or validation.

CDataExchange::PrepareOleCtrl

Prepares the specified OLE control for data exchange or validation. Use for nonedit controls.

Name

Description

CDataExchange::m_bSaveAndValidate

Flag for the direction of DDX and DDV.

CDataExchange::m_pDlgWnd

The dialog box or window where the data exchange takes place.

CDataExchange does not have a base class.

Use this class if you are writing data exchange routines for custom data types or controls, or if you are writing your own data validation routines. For more information on writing your own DDX and DDV routines, see Technical Note 26. For an overview of DDX and DDV, see Dialog Data Exchange and Validation and Dialog Boxes.

A CDataExchange object provides the context information needed for DDX and DDV to take place. The flag m_bSaveAndValidate is FALSE when DDX is used to fill the initial values of dialog controls from data members. The flag m_bSaveAndValidate is TRUE when DDX is used to set the current values of dialog controls into data members and when DDV is used to validate the data values. If the DDV validation fails, the DDV procedure will display a message box explaining the input error. The DDV procedure will then call Fail to reset the focus to the offending control and throw an exception to stop the validation process.

Header: afxwin.h

Show: