OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TPXPictureValidator Class Reference

TPXPictureValidator objects compare user input with a picture of a data format to determine the validity of entered data. More...

#include <owl/validate.h>

Inheritance diagram for owl::TPXPictureValidator:
owl::TValidator owl::TStreamableBase

Public Member Functions

 TPXPictureValidator (LPCTSTR pic, bool autoFill=false)
 Constructs a picture validator object by first calling the constructor inherited from TValidator and setting pic to point to it.
 
 TPXPictureValidator (const tstring &pic, bool autoFill=false)
 String-aware overload.
 
void Error (TWindow *owner)
 Overrides TValidator's virtual function and displays a message box that indicates an error in the picture format and displays the string pointed to by Pic.
 
bool IsValidInput (TCHAR *str, bool suppressFill)
 IsValidInput overrides TValidator's virtual function and checks the string passed in str against the format picture specified in Pic.
 
bool IsValid (LPCTSTR str)
 IsValid overrides TValidator's virtual function and compares the string passed in str with the format picture specified in Pic.
 
int Adjust (tstring &text, int &begPos, int &endPos, int amount)
 Adjusts the 'value' of the text, given a cursor position and an amount.
 
virtual TPicResult Picture (TCHAR *input, bool autoFill=false)
 Checks the validity of the input according to the format specified by the picture string, possibly adding fill characters to the end of the input.
 
const tstringGetPic () const
 Returns the picture mask used by the validator.
 
void SetPic (const tstring &pic)
 Sets the picture mask for the validator.
 
- Public Member Functions inherited from owl::TValidator
 TValidator ()
 Constructs an abstract validator object and sets Options fields to 0.
 
virtual ~TValidator ()
 Destroys an abstract validator object.
 
virtual uint Transfer (TCHAR *text, void *buffer, TTransferDirection direction)
 Allows a validator to set and read the values of its associated edit control.
 
bool Valid (LPCTSTR str, TWindow *owner=0)
 Returns true if IsValid returns true.
 
bool Valid (const tstring &str, TWindow *owner=0)
 
bool HasOption (int option)
 Gets the Options bits. Returns true if a specified option is set.
 
void SetOption (int option)
 Sets the bits for the Options data member.
 
void UnsetOption (int option)
 Unsets the bits specified in the Options data member.
 
- Public Member Functions inherited from owl::TStreamableBase
virtual ~TStreamableBase ()
 

Additional Inherited Members

- Protected Attributes inherited from owl::TValidator
uint16 Options
 A bitmap member used to control options for various descendants of TValidator.
 

Detailed Description

TPXPictureValidator objects compare user input with a picture of a data format to determine the validity of entered data.

The pictures are compatible with the pictures Borland's Paradox relational database uses to control data entry. For a complete description of picture specifiers, see the Picture member function.

Definition at line 145 of file validate.h.

Constructor & Destructor Documentation

◆ TPXPictureValidator() [1/2]

owl::TPXPictureValidator::TPXPictureValidator ( LPCTSTR pic,
bool autoFill = false )

Constructs a picture validator object by first calling the constructor inherited from TValidator and setting pic to point to it.

Then sets the voFill bit in Options if AutoFill is true and sets Options to voOnAppend. Throws a TXValidator exception if the picture is invalid.

Definition at line 29 of file pictval.cpp.

◆ TPXPictureValidator() [2/2]

owl::TPXPictureValidator::TPXPictureValidator ( const tstring & pic,
bool autoFill = false )

String-aware overload.

Definition at line 40 of file pictval.cpp.

Member Function Documentation

◆ Adjust()

int owl::TPXPictureValidator::Adjust ( tstring & text,
int & begPos,
int & endPos,
int amount )
virtual

Adjusts the 'value' of the text, given a cursor position and an amount.

Returns the actual amount adjusted.

Reimplemented from owl::TValidator.

Definition at line 110 of file pictval.cpp.

◆ Error()

void owl::TPXPictureValidator::Error ( TWindow * owner)
virtual

Overrides TValidator's virtual function and displays a message box that indicates an error in the picture format and displays the string pointed to by Pic.

Reimplemented from owl::TValidator.

Definition at line 65 of file pictval.cpp.

References PRECONDITION.

◆ GetPic()

const tstring & owl::TPXPictureValidator::GetPic ( ) const
inline

Returns the picture mask used by the validator.

Definition at line 380 of file validate.h.

◆ IsValid()

bool owl::TPXPictureValidator::IsValid ( LPCTSTR input)
virtual

IsValid overrides TValidator's virtual function and compares the string passed in str with the format picture specified in Pic.

IsValid returns true if Pic is NULL or if Picture returns Complete for str, indicating that str needs no further input to meet the specified format; otherwise, it returns false.

Reimplemented from owl::TValidator.

Definition at line 96 of file pictval.cpp.

References CONST_CAST, Picture(), owl::prComplete, and owl::prEmpty.

◆ IsValidInput()

bool owl::TPXPictureValidator::IsValidInput ( TCHAR * input,
bool suppressFill )
virtual

IsValidInput overrides TValidator's virtual function and checks the string passed in str against the format picture specified in Pic.

IsValid returns true if Pic is NULL or Picture does not return Error for str; otherwise, it returns false. The suppressFill parameter overrides the value in voFill for the duration of the call to IsValidInput. If suppressFill is false and voFill is set, the call to Picture returns a filled string based on str, so the image in the edit control automatically reflects the format specified in Pic.

Reimplemented from owl::TValidator.

Definition at line 82 of file pictval.cpp.

References owl::TValidator::Options, Picture(), owl::prError, and owl::voFill.

◆ Picture()

TPicResult owl::TPXPictureValidator::Picture ( TCHAR * input,
bool autoFill = false )
virtual

Checks the validity of the input according to the format specified by the picture string, possibly adding fill characters to the end of the input.

Formats the string passed in input according to the format specified by the picture string pointed to by Pic. Picture returns prError if there is an error in the picture string or if input contains data that cannot fit the specified picture. Returns prComplete if input can fully satisfy the specified picture. Returns prIncomplete if input contains data that incompletely fits the specified picture. The following characters are used in creating format pictures:

Special

  • # Accept only a digit
  • ? Accept only a letter (case_insensitive)
  • & Accept only a letter, force to uppercase
  • @ Accept any character
  • ! Accept any character, force to uppercase Match
  • ; Take next character literally
  • * Repetition count
  • [] Option
  • {} Grouping operators
  • , Set of alternatives
  • All others Taken literally

Definition at line 624 of file pictval.cpp.

References _T, _tcschr, _tcslen, CharSize(), owl::prAmbiguous, owl::prComplete, owl::prEmpty, owl::prError, owl::prIncomplete, owl::prIncompNoFill, owl::prSyntax, and owl::TXValidator::Raise().

◆ SetPic()

void owl::TPXPictureValidator::SetPic ( const tstring & pic)
inline

Sets the picture mask for the validator.

Definition at line 388 of file validate.h.


The documentation for this class was generated from the following files: