COXMaskedEdit::OnValidate
virtual BOOL OnValidate()
Return Value
TRUE if the current text passes validation, otherwise FALSE.
Remarks
This virtual function gets called when the control loses focus, unless the OMMEN_VALIDATE notification handler of the parent decides otherwise (see below). Use in a COXMaskedEdit derived class to perform user validation. The default implementation returns TRUE.
If this method returns FALSE, the virtual method ValidationError will be called. The default behavior of COXMaskedEdit::ValidationError is to simply sound a message beep.
There is another way to provide data validation that can be used irregardless of the control being used as a base class.
When the control loses focus it will send a WM_NOTIFY notification to its parent passing the ID of the control in wParam and a pointer to a MENMHDR structure in lParam. The hdr.code member of the structure will contain OXMEN_VALIDATE.
There are two BOOL members of the MENMHDR structure you can modify to return information on what action to take:
MENMHDR.bVaild |
Specifies whether data is valid. |
MENMHDR.bDefaultValidation |
Specifies whether to call OnValidate. |
See also: ValidationError