A SERVICE OF

logo

valid data. IsValid does the actual data validation, so if you create your own
validator objects, you’ll probably override IsValid.
Note that you don’t call IsValid directly Use Valid to call IsValid, because.
Valid calls Error to alert the user if IsValid returns FALSE. This separates the
validation role from the error-reporting role.
When an edit control object recognizes a keystroke event intended for it, it
Member function
calls its validator’ IsValidInput member function to ensure that the entereds
IsValidInput
character is a valid entry By default, IsValidInput member functions always.
return TRUE, meaning that all keystrokes are acceptable, but some derived
validators override IsValidInput to filter out unwanted keystrokes.
For example, range validators, which are used for numeric input, return
TRUE from IsValidInput only for numeric digits and the characters ‘+’
and ‘-’.
IsValidInput takes two parameters:
virtual BOOL IsValidInput(char far* str, BOOL suppressFill);
The first parameter str, points to the current input text being validated. The,
second parameter is a Boolean value indicating whether the validator
should apply filling or padding to the input string before attempting to
validate it. TPXPictureValidator is the only standard validator object that
uses the second parameter.
Virtual member function Error alerts the user that the contents of the edit
Member function
control don’t pass the validation check. The standard validator objects
Error
generally present a simple message box notifying the user that the contents
of the input are invalid and describing what proper input would be.
For example, the Error member function for a range validator object creates
a message box indicating that the value in the edit control is not between
the indicated minimum and maximum values.
Although most descendant validator objects override Error, you should
never call it directly Valid calls Error for you if IsValid returns FALSE,.
which is the only time Error needs to be called.
332
OWL P ogrammer’ Guider s