The Text Objects: 5.4 Using VisText: Text Filters

Up: GEOS SDK TechDocs | Up | Prev: 5.3 VisText VM File Storage | Next: 5.5 Key Functions
VTI_filters, VisTextFilters, VisTextFilterClass, ATTR_VIS_TEXT_EXTENDED_FILTER, MSG_VIS_TEXT_SET_FILTER, MSG_VIS_TEXT_GET_FILTER

When the user enters text into the text object, the text object is able to filter out characters that it does not wish to be displayed. This behavior is produced through use of VisTextFilters .

VTI_ filters stores a VisTextFilters record. This record has several entries:

VTF_NO_SPACES filters out any space characters.
VTF_NO_TABS filters out any tab characters.

VTF_UPCASE_CHARS ensures that any alphabetic characters are made uppercase. Other characters are unaffected.

VTF_FILTER_CLASS stores a VisTextFilterClass . This value can be any one of the following:

VTFC_NO_FILTER
VTFC_ALPHA
VTFC_NUMERIC
VTFC_SIGNED_NUMERIC
VTFC_SIGNED_DECIMAL
VTFC_FLOAT_DECIMAL
VTFC_ALPHA_NUMERIC
VTFC_FILENAMES
VTFC_DOS_FILENAMES
VTFC_DOS_PATH
VTFC_DATE
VTFC_TIME
VTFC_DASHED_ALPHA_NUMERIC
VTFC_NORMAL_ASCII
VTFC_DOS_VOLUME_NAMES
VTFC_DOS_CHARACTER_SET
VTFC_ALLOW_COLUMN_BREAKS

For more complex filtering, you can include ATTR_VIS_TEXT_EXTENDED_FILTER in your text object. Each value corresponds to a different message which you can intercept to provide custom filtering. These values are:

VTEFT_REPLACE_PARAMS
This filter generates MSG_VIS_TEXT_FILTER_VIA_REPLACE_PARAMS. This message passes a VisTextReplaceParameters structure that you can either accept or reject as a whole. This will be supported in an upcoming release.
VTEFT_CHARACTER_LEVELER_LEVEL
This filter generates MSG_VIS_TEXT_FILTER_VIA_CHARACTER. This message passes a single character that you can either accept or reject.
VTEFT_BEFORE_AFTER
This filter generates MSG_VIS_TEXT_FILTER_VIA_BEFORE_AFTER. This message passes two buffers containing the current text and the proposed new text. This will be supported in an upcoming release.

MSG_VIS_TEXT_GET_FILTER

byte	MSG_VIS_TEXT_GET_FILTER();

This message retrieves the current VisTextFilters in use by the text object (stored in VTI_ filters ).

Source: Unrestricted.

Destination: Any text object.

Return: VisTextFilters in use by the text object.

Interception: Generally not intercepted.

MSG_VIS_TEXT_SET_FILTER

void	MSG_VIS_TEXT_SET_FILTER(
        byte		filter);

This message sets the text object's VisTextFilters (stored in VTI_ filters ) to the passed value. Resetting this filter does not affect any text that already exists in the text object.

Source: Unrestricted.

Destination: Any text object.

Parameters: filter VisTextFilters to set.

Interception: Generally not intercepted.

MSG_VIS_TEXT_FILTER_VIA_CHARACTER

word	MSG_VIS_TEXT_FILTER_VIA_CHARACTER(
        word		charToFilter);

This message allows the text object to filter text on a character by character basis. This message is called for each character that is entered into the text object.

This message will be generated if the text object includes ATTR_VIS_TEXT_EXTENDED_FILTER in its instance data, with its value set to the VisTextExtendedFilterType VTEFT_CHARACTER_LEVELER_LEVEL.

Source: Sent by the system if text object contains ATTR_VIS_TEXT_EXTENDED_FILTER set to VTEFT_CHARACTER_LEVELER_LEVEL.

Destination: Any text object

Parameters: charToFilter Character value that is being filtered. You can pass this value on to the superclass or filter it out.

Interception: Must intercept to provide character by character filtering.


Up: GEOS SDK TechDocs | Up | Prev: 5.3 VisText VM File Storage | Next: 5.5 Key Functions