OWLNext 7.0
Borland's Object Windows Library for the modern age
|
Because validator objects are not interface objects, their constructors require only enough information to establish the validation criteria. For example, a numeric-range validator object requires only two parameters: the minimum and maximum values in the valid range.
Every edit control object has a data member that can point to a validator object. This pointer's declaration looks like this:
Assign a validator by calling the edit control object's TEdit::SetValidator member function. The edit control automatically checks with the validator object when processing key events and when called on to validate itself.
The following code shows the construction of a validator and its assignment to an edit control. In this case, a filter validator that allows only alphabetic characters is used.
A complete example showing the use of the standard validators can be found in EXAMPLES\OWL\CLASSES\VALIDATE.