OWLNext 7.0
Borland's Object Windows Library for the modern age
|
Picture validators compare the string entered by the user with a "picture" or template that describes the format of valid input.
The pictures used are compatible with those used by Borland's Paradox relational database to control user input.
Constructing a picture validator requires two parameters: a string holding the template image and a Boolean value indicating whether to automatically fill-in the picture with literal characters:
TPXPictureValidator overrides TPXPictureValidator::Error, TPXPictureValidator::IsValid, and TPXPictureValidator::IsValidInput, and adds a new member function, TPXPictureValidator::Picture. Error displays a message box indicating what format the string should have. IsValid returns true only if the function Picture returns true; thus you can derive new kinds of picture validators by overriding only the Picture member function. IsValidInput checks characters as the user enters them, allowing only those characters permitted by the picture format and optionally filling in literal characters from the picture format.
Here is an example of a picture validator that is being constructed to accept social security numbers:
The Picture member function tries to format the given input string according to the picture format and returns a value indicating the degree of its success.
The following code lists those return values: