EDITMASK property
Applies To
ditLines and EditMasks
Description
The ability to apply VALID and CONV properties to an EditLine control is a very powerful way to validate and format data entered into your applications, but this commonly relies on the user knowing how the data should be input without any visual clues being provided by the UI. Some formats like dates are fairly obvious, but others are not, and this can lead to user frustration.
In order to improve this situation the EditLine control now supports a new property called EDITMASK, which allows you to specify the input format of the data in a visual manner, along with the type of character that may be entered at each character position, thus reducing the probability of typing errors and thereby leading to a smoother user experience.
Usage
This property is a dynamic array composed of three fields:
Remarks
Value | Description |
---|---|
<1> | The Input Mask |
<2> | The Format Mask |
<3> | The default Character |
The Format Mask is what the user sees in the control when no data has been entered. The characters that they may edit are denoted by the "_" character, which is used as a placeholder. So, for a date the format mask could be "__/__/____", meaning they are allowed to edit the first two characters, the fourth and fifth character, and the last four characters. They will not be able to change either of the "/" characters.
The Input Mask controls the type of character that may be entered at each position where there is a placeholder "_" in the Format Mask. There should be one type specifier for each "_" character in the Format Mask, and a space character for the non-editable characters. The type specifiers are:
"D" - A digit
"d" - A digit or a space
"C" - An alpha character
"c" - An alpha character or space
"A" - An alphanumeric character
"a" - An alphanumeric character or space
"X" - A hexadecimal character
"x" - A hexadecimal character or space
"*" - Any printable character
"+" - A "+" character, a "-' character, or space
So, for our date example we could have "dd dd dddd". Note that the Input Mask must always be the same lenght as the Format Mask, otherwise the EDITMASK property will not work.
The Default Character is the character used for each invalid character in the user input. This defaults to an underscore ("_").
To create a phone and date example, you would set the following EDITMASK properties like so:
phoneMask = "ddd ddd dddd" : @fm : "(___) ___-____" : @fm : "_" dateMask = "Dd Dd dddd" : @fm : "__/__/____" : @fm : "_" objxArray = @window : ".EDL_PHONE" propArray = "EDITMASK" dataArray = phoneMask objxArray := @rm : @windows : ".EDL_DATE" propArray := @rm : "EDITMASK" dataArray := @rm : dateMask call set_Property( objxArray, propArray, dataArray )