Maskeditbox
Description:
A single line edit box where a mask is used to control the allowed user input.
Mask:
A mask must be defined to control the allowed user input. Default there are three mask characters allowed.
- 9: the input character must be numeric [0-9]
- a: the input character must be alpha [A-Z, a-z]
- *: all alphanumeric characters allowed as input i.e. [A-Z, a-z, 0-9]
- any other character used in the mask will be interpreted as separator character and will be shown as such in the Maskeditbox.
During input in the Maskeditbox the input characters will be checked with the allowed values and rejected when outside the allowed values.
Examples:
- US phone number mask: "(999) 999-9999" example input will show in the Maskeditbox as "(___) ___-____" when the placeholder character is set to the default "_". An allowed input value could then be "(555) 126-8328".
- Dutch car-badge mask: "99-aaa-9". Using placeholder character "x" this will show as "xx-xxx-xx". An example input could then be "52-ZXL-3".
Note: The mask characters that are allowed can be set in the MaskDefinitions of the Application options.
IncludeLiterals:
When the property IncludeLiterals is set to True, the input value will be returned in the code exactly as shown in
the Maskeditbox, e.g. "(555) 126-8328" for the US phone number. When set to False only the input characters will be
returned, i.e. "5551268328" for the phone number.
Dynamic Mask:
Masks can be changed dynamically in the code through the .mask property of the Maskeditbox. E.g.
Note: If the mask of a maskeditbox which already holds a value is changed dynamically, any characters which are no longer allowed by the new mask will be displayed as placeholder characters.
Placeholder:
A single character to show in the Maskeditbox at the places of the editable characters in the displayed mask.
It is important that the placeholder character may not be used in the mask definition, please keep this in mind when choosing a placeholder character.
ClearEmpty:
When set to True, the Maskeditbox will show empty when no input has been entered and the Maskeditbox is not selected. When selected the input mask will show.
When set to False, the mask will be shown in all situations.
Setting the Value directly in the Code
It is possible to set the value of a Maskeditbox object directly in the code (e.g. Maskedit_10 := '(42-BX-05)'). Be aware that when setting the value in the code the mask will not be applied to the assigned value and values can be set that are not allowed by the mask without any warning or error message (e.g. Maskedit_10 := 'NotCorrect' when the mask is '(99-AA-99)' ). |
Toolbar button icon:
Properties:
- 3D
- BorderStyle
- ClearEmpty
- Color
- Description
- Enabled
- Encrypted
- Font
- Height
- HelpText
- IncludeLiterals
- Left
- Mask
- OccursData
- Parent
- Placeholder
- ReadOnly
- TabNumber
- TabStop
- Top
- Visible
- Width
- ZOrder
Events:
Dynamic properties: