"inputMask"
Allows you to define what characters are allowed at what position within a text field.
Synopsis
inputMask(string mask)
Parameters
Parameters | Description |
---|---|
mask | Input validation mask |
Description
When an input mask is set, the "text" property returns a modified copy of the line edit content where all the blank characters have been removed.
When using an input mask, the format of the text field must be set to
string
.
In addition, the "Command" script of the text field must be used, i.e. return must be pressed to evaluate the input mask. Only if the input text follows the rules of the input mask - e.g. all required characters have been entered - the command script is triggered.
Functions like min() and max() can only be used for the float and int formats, not for the string format and therefore not when using inputMask.
The input mask is an input template string. It can contain the following elements:
- Mask Characters
- Defines the Category of input characters that are considered valid in this position
- Meta Characters
- Various special meanings
- Separators
- All other characters are regarded as immutable separators
The following table shows the mask and meta characters that can be used in an input mask.
Mask Character | Meaning |
---|---|
A | character of the Letter category required, such as A-Z, a-z. |
a | character of the Letter category permitted but not required. |
N | character of the Letter or Number category required, such as A-Z, a-z, 0-9. |
n | character of the Letter or Number category permitted but not required. |
X | Any non-blank character required. |
x | Any non-blank character permitted but not required. |
9 | character of the Number category required, e.g 0-9. |
0 | character of the Number category permitted but not required. |
D | character of the Number category and larger than zero required, such as 1-9 |
d | character of the Number category and larger than zero permitted but not required, such as 1-9. |
# | character of the Number category, or plus/minus sign permitted but not required. |
H | Hexadecimal character required. A-F, a-f, 0-9. |
h | Hexadecimal character permitted but not required. |
B | Binary character required. 0-1. |
b | Binary character permitted but not required. |
Meta Character | Meaning |
---|---|
> | All following alphabetic characters are uppercased. |
< | All following alphabetic characters are lowercased. |
! | Switch off case conversion. |
;c | Terminates the input mask and sets the blank character to c. |
[ ] { } | Reserved. |
\ | Use \ to escape the special characters listed above to use them as separators. |