| superclass(es) | edit |
| subclass(es) | - |
| description | The maskEdit class is a simple single line editor class that can be
programmed to accept only certain characters, like numbers, at specified positions. |
| see also | panel - editControl - edit |
Creating the edit control and setting options like the justification of the text is done by methods of the classes editControl and edit. The panel class has two methods that make it easier to create a masked edit control. The maskEdit class extends the super class edit with methods specific for masking the input of the user. The mask is a string that specifies which characters may be entered by the user at positions, the meaning of the control characters in the mask string are:
The mask string can be retrieved and set by the methods mask/1
and putMask/2. The current entered text without the space
characters but with the literal characters inserted by the mask can be retrieved by
calling the method textWithoutMask/1 and textWithoutMask/4. The text without the empty characters
and the literal characters inserted by the mask can be retrieved by calling userText/1. The character used if the user may enter a space
character can be retrieved and set by the methods whitespaceChar/1
and putWhitespaceChar/1. Since Trinc-Prolog R3B is the default behavior that a maskEdit does not display empty mask characters if it does not have the keyboard focus. A maskEdit control has the keyboard focus if the blinking caret is visible inside a maskEdit control. This new behavior can be turned off by calling the method putAlwaysDisplayMask/1 with the value true. |
| func | Return the mask string of the control. |
| pre | TRUE |
| post | The mask string was assigned to the variable OutputString. |
| func | Assign a mask string to the control. |
| pre | The variable String must contain a string. |
| post | If the mask string was successfully stored then was true unified with the value of Output, else was false assigned. |
textWithoutMask(?OutputString)
| func | Create a string that contains the characters entered by the user and all
of the literal characters as specified in the mask string of the control. The empty
characters visible are not included. For the masked edit with the text entered: and the mask 'NN\\NN\\NN', this method returns the string '55\5\5'. |
| pre | TRUE |
| post | The characters entered by the user and the literal characters inserted by the mask string were copied to the OutputString variable. |
textWithoutMask(+IncludeLiteral, +IncludeEmpty, +TranslateZToZero, ?OutputString)
| func | Create a string that contains the characters entered by the user. The
first three parameters determine which characters are or are not included in the result
string. If the value of the parameter IncludeLiteral is true then are literal characters
included in the result string, else not. If true is the value of IncludeEmpty then are
empty characters included, else not. If empty characters are included then
TranslateZToZero determines if the empty characters that correspond to 'Z' characters in
the mask are translated to zero ('0') characters or not. Example: if the values of the
first three parameters is true and the mask is 'ZZ\\ZZ\\NN' and the masked edit contains
the text: |
| pre | The values of the parameters IncludeLiteral, IncludeEmpty and TranslateZToZero must be boolean values. |
| post | The characters entered by the user and the literal characters inserted by the mask string were copied to the OutputString variable. |
| func | Create a string that contains only the characters entered by the user and
none of the literal characters or empty characters. For the masked edit with the text entered: |
| pre | TRUE |
| post | The characters entered by the user were copied to the OutputString variable. |
| func | Return the space character used by the masked edit control. |
| pre | TRUE |
| post | The whitespace character used was assigned to the OutputString variable. |
| func | Assign a character to be used as the space character of the masked edit control. |
| pre | The variable string must contain a string with at least a single character. |
| post | The whitespace character was assigned to the edit control. |
| func | Determine if the character at the position Pos was entered by the user or inserted because of a literal character in the mask string. The position of the first character is 0. |
| pre | The variable Pos must contain an integer value. |
| post | If the character at position Pos is a literal character of the mask string then true was assigned to Output, else false was assigned to Output. |
findCharInText(+Pos, ?Output, ?OutputString, ?Literal, ?SetChar)
| func | Get the character from the text of the masked edit control at the position Pos. |
| pre | The variable Pos must contain an integer value. |
| post | If the character was found then true was assigned to Output, the character was assigned to the variable OutputString. If the character was not found then no value was assigned to OutputString. If the character at position Pos is a literal character of the mask string then true was assigned to Literal, else false was assigned to Literal. If the character was found and was part of a set (for instance: \{abcdef}) then true was assigned to SetChar, else was false assigned. |
findCharInMask(+Pos, ?Output, ?OutputString)
| func | Get the character from the mask of the masked edit control at the position Pos. |
| pre | The variable Pos must contain an integer value. |
| post | If the character was found then true was assigned to Output, the character was assigned to the variable OutputString. If the character was not found then no value was assigned to OutputString. |
findCharInMask(+Pos, ?Output, ?OutputString, ?Literal, ?SetChar)
| func | Get the character from the mask of the masked edit control at the position Pos. |
| pre | The variable Pos must contain an integer value. |
| post | If the character was found then true was assigned to Output, the character was assigned to the variable OutputString. If the character was not found then no value was assigned to OutputString. If the character at position Pos is a literal character of the mask string then true was assigned to Literal, else false was assigned to Literal. If the character was found and was part of a set (for instance: \{abcdef}) then true was assigned to SetChar, else was false assigned. |
| func | Determine if empty mask characters are visible when the control does not have the focus. The current version (since Trinc-Prolog R3B) of this control does not display the mask when it does not have the keyboard focus. To restore the old behavior of the maskEdit control call this method with the parameter value true. |
| pre | The variable YesNo must contain a boolean value. |
| post | If the value of the parameter was true then are the mask characters always visible, else only when the control has the keyboard focus. |
checkAlwaysDisplayMask(?Output)
| func | Check if empty mask characters are visible when the control does not have the focus. The default behavior since Trinc-Prolog R3B is the default behavior to not display mask characters es not display the mask when it does not have the keyboard focus. |
| pre | The variable YesNo must contain a boolean value. |
| post | If the value of the parameter was true then are the mask characters always visible, else only when the control has the keyboard focus. |