To use the Edit Mask feature with the DIALOG command, you must start the text string with || (double pipe character). The edit mask string consists of three fields with semicolons separating them. The first part of the mask is the mask itself. The second part is the character that determines whether the literal characters of the mask (dashes in social security number or parenthesis and hyphen for a phone number) are matched to characters of the first part or are inserted into the resulting value string. The third part of the mask is the character used to represent missing characters in the mask.
These are the special characters used in the first part of the mask:
Character |
Meaning in mask |
! |
If a ! character appears in the mask, optional characters are represented in the returned string as leading blanks. If a ! character is not present, optional characters are represented in the returned string as trailing blanks. |
> |
If a > character appears in the mask, all characters that follow are in uppercase until the end of the mask or until a < character is encountered. |
< |
If a < character appears in the mask, all characters that follow are in lowercase until the end of the mask or until a > character is encountered. |
<> |
If these two characters appear together in a mask, no case checking is done. |
\ |
The character that follows a \ character is a literal character. Use this character to use any of the mask special characters as a literal. |
L |
The L character requires an alphabetic character only in this position. For the US, this is A_Z, a_z. |
| |
The l character permits only an alphabetic character in this position, but doesn't require it. |
A |
The A character requires an alphanumeric character only in this position. For the US, this is A_Z, a_z, 0_9. |
a |
The a character permits an alphanumeric character in this position, but doesn't require it. |
C |
The C character requires an arbitrary character in this position. |
c |
The c character permits an arbitrary character in this position, but doesn't require it. |
0 |
The 0 character requires a numeric character only in this position. |
9 |
The 9 character permits a numeric character in this position, but doesn't require it. |
# |
The # character permits a numeric character or a plus or minus sign in this position, but doesn't require it. |
: |
The : character is used to separate hours, minutes, and seconds in times. If the character that separates hours, minutes, and seconds is different in the regional settings of the Control Panel, that character is substituted in the returned string. |
/ |
The / character is used to separate months, days, and years in dates. If the character that separates months, days, and years is different in the regional settings of the Control Panel, that character is substituted in the returned string. |
; |
The ; character is used to separate the three fields of the mask. |
_ |
The _ character automatically inserts spaces into the returned string. |
Any character that does not appear in the preceding table can appear in the first part of the mask as a literal character. Literal characters are inserted automatically if the second field of the mask is 0, or matched to characters in the first part, if the second field is any other value. The special mask characters can also appear as literal characters if preceded by a backslash character (\).
The second part of the mask is a single character that indicates whether literal characters from the mask are included in the resulting value string. For example, the mask for a telephone number with area code could be the following string:
(000)_000_0000;0;*
The 0 in the second field indicates that the first part should consist of the 10 digits of the phone number, rather than the 14 characters that make up the final formatted string.
The 0 in the second field indicates that literals (dashes in social security number or parenthesis and hyphen for a phone number) are inserted into the resulting value string. Any other character besides zero indicates that that literals characters are included in the resulting value string.
The third part of the mask is the character that appears in the returned string for blanks. By default, this is the same as the character that stands for literal spaces. The two characters appear the same in the DIALOG. However, when a user edits the text in a masked edit control, the cursor selects each blank character in turn, and skips over the space character.
Note:
When working with multibyte character sets, such as Japanese Shift_JIS, each special mask character represents a single byte. To specify double_byte characters using the L,l,A,a,C, or c specifiers, the mask characters must be doubled as well. For example, LL would represent two single_byte alphabetic characters or a one double_byte character. Only single_byte literal characters are supported.
Typical Field Formats by Country:
United States |
|
Phone |
| 4155551212 | !\(999\)000_0000;1;_ |
Extension |
| 15450 | !99999;1;_ |
Social Security No |
| 555555555 | 000\_00\_0000;1;_ |
Short Zip Code |
| 90504 | 00000;1;_ |
Long Zip Code |
| 905040000 | 00000\_9999;1;_ |
Date |
| 062794 | !99/99/00;1;_ |
Long Time |
| 090515PM | !90:00:00>LL;1;_ |
Short Time |
| 1345 | !90:00;1;_ |
United Kingdom |
|
Phone |
| 1714561234 | !\00009 0000099;1;_ |
Extension |
| 15450 | !99999;1;_ |
Postcode |
| WT3114TA | >AAAa aaaa;1;_ |
Short Postcode |
| EC12 | >AAAa;1;_ |
National Insurance |
| GM134152A | !>AA000000A;1;_ |
Date |
| 270195 | !90/90/00;1;_ |
Long Time |
| 090515PM | !90:00:00>LL;1;_ |
Short Time |
| 1345 | !90:00;1;_ |
Taiwan |
|
Zip Code |
| 107 | 000;1;_ |
Organization No |
| 86692741 | 00000000;1;_ |
Social Security No |
| A324534422 | L000000000;1;_ |
ROC Date |
| 00850930 | !9990.00.00;1;_ |
Date |
| 100196 | 00/00/00;1;_ |
Phone |
| 03532455768 | \(999\)9000_0000;1;_ |
Mobile Phone |
| 090789879 |000_000000;1;_ |
Pager |
| 060345678 |000_000000;1;_ |
Sweden |
|
Social Security No |
| 6011012110 | 000000\_0000;1;_ |
Organization Number |
| 6011012110 | 000000\_0000;1;_ |
Zip Code |
| 64700 | 000 00;1;_ |
Date |
| 950223 | !00/00/00;1;_ |
Long Date |
| 19950223 | !0000/00/00;1;_ |
Long Time |
| 210515 | !90:00:00;1;_ |
Short Time |
| 1345 | !90:00;1;_ |
Spain |
|
Phone |
| 4155551212 | !\(999\)0000000;1;_ |
Social Security No |
| 123456789123456 | 0000000000000;1;_ |
Zip Code |
| 90504 | 00000;1;_ |
Date |
| 250895 | !99/99/00;1;_ |
Long Time |
| 210515 | !90:00:00;1;_ |
Short Time |
| 1345 | !90:00;1;_ |
Norway |
|
Phone |
| 22831310 | 00 09 99 99;1;_ |
Social Security No |
| 01016512345 | 0000000 0000;1;_ |
Organization Number |
| 01016512345 | 0000000 0000;1;_ |
Zip Code |
| 0250 | 0000;1;_ |
Date |
| 170595 | 00\/00\_00;1;_ |
Date |
| 170595 | 00/00/00;1;_ |
Long Time |
| 210515 | !90:00:00;1;_ |
Short Time |
| 1345 | !90:00;1;_ |
Banking |
| 12341212345 | 0000 00 00000;1;_ |
Netherland |
|
Phone |
| 205405400 | !\00099\_0000999;1;_ |
Social Security No |
| 123456789 | 000000000;1;_ |
Zip Code |
| 1234AB | 0000 >LL;1;_ |
Date |
| 270695 | !90/90/00;1;_ |
Long Time |
| 214515 | !90:00:00;1;_ |
Short Time |
| 1345 | !90:00;1;_ |
Korea |
|
Phone |
| 025381890 | !\(9999\)000_0000;1;_ |
Handphone(Beeper) |
| 0005381895 | !000_000_0000;1;_ |
Social Security No |
| 9507271234567 | 000000_0000000;1;_ |
Zip Code |
| 135080 | 000_000;1;_ |
Date 1 |
| 950727 | 00_!90_90;1;_ |
Date 2 |
| 19950727 | !0000_!90_90;1;_ |
Date 3 |
| 950727 | 00|?!90¥90L|;1;_ |
Date 4 |
| 19950727 | !0000|?!90¥90L|;1;_ |
Long Time |
| 042520PM | !90:00:00 >LL;1;_ |
Long Korean time |
| 042520PM | !90_+00||00+| >LL;1;_ |
Short Time |
| 1625 | !90:00;1;_ |
Short Korean Time |
| 1625 | !90_+00||;1;_ |
Japan |
|
Phone |
| 0353508393 | !099999_0999_0000;1;_ |
Zip Code |
| 1510073 | 000\_0000;1;_ |
Date |
| 062794 | !99/99/00;1;_ |
Time |
| 090515PM | !90:00:00>LL;1;_ |
Italy |
|
Phone |
| 0212345678 | !\(9999\) 0000 0000;1;_ |
Phone with Extension |
| 02123456781234 | !\(9999\) 0000 0000\.9999;1;_ |
Local Phone |
| 12345678 | !0000 0000;1;_ |
Company Tax # |
| 00010010023 | 00000000000;1;_ |
Tax Payer # |
| TRMDNC55P27B242Z | >LLLLLL00L00L000L;1;_ |
Zip Code |
| 00100 | 00000;1;_ |
Short Date |
| 130295 | !99/99/00;1;_ |
Long Date 1 |
| 130295 | !99/99/\1\900;1;_ |
Long Date 2 |
| 13Gen95 | !99 >L<LL \1\900;1;_ |
Long Time |
| 210515 | !90:00:00;1;_ |
Short Time |
| 1345 | !90:00;1;_ |
Germany |
|
Phone |
| 06103979 | !\(999 99\) 99999;1;_ |
Extension |
| 2010 | !_9999;1;_ |
Banking |
| 50850150 | 000\ 000\ 00;1;_ |
BRD ZIP Code |
| 63225 | D_00000;1;_ |
Intl ZIP Code |
| CH50000 | >cc_99999;1;_ |
Date |
| 301193 | !90/90/00;1;_ |
Short Time |
| 1345 | !90:00;1;_ |
Long Time |
| 193059 | !90:00:00;1;_ |
France |
|
Telephone |
| 0299887766 | !00\_00\_00\_00\_00;1;_ |
Bank Card |
| 5555444433332222 | !0000 0000 0000 0000;1;_ |
Social Security No |
| 166107811122233 | !0000000000000\_99;1;_ |
Zip Code |
| 92130 | !00000;1;_ |
Short Date |
| 2712 | !99/99;1;_ |
Long Date 1 |
| 271296 | !99/99/00;1;_ |
Long Date 2 |
| 27Déc1996 | !99 >L<LL 0000;1;_ |
Long Time |
| 134515 | !90:00:00;1;_ |
Short Time |
| 1345 | !90:00;1;_ |
Denmark |
|
Phone |
| 48140001 | 00 09 99 99;1;_ |
Phone with Country |
| 48140001 | \+45 00 00 00 00;1;_ |
Social Security No |
| 1234567890 | 000000\_0000;1;_ |
Zip Code |
| 3450 | 0000;1;_ |
Zip Code with Country |
| DK3450 | !>LL\_0000;1;_ |
Date |
| 260195 | 90\.90\.\1\900;1;_ |
Date |
| 260195 | 90/90/00;1;_ |
Long Time |
210515 | !90:00:00;1;_ |
Short Time |
| 1345 | !90:00;1;_ |
Example 01: (Capturing Social Security Number)
SET VAR vSSN TEXT = NULL
CLS
DIALOG 'Enter Social Security Number||000_00_0000;0;_' +
vSSN=20 vEndKey 1 CAPTION 'Example 01' ICON 'APPS'
Example 01a: (Capturing Social Security Number)
SET VAR vSSN TEXT = NULL
SET VAR vMessage TEXT = 'Enter Social Security Number||000_00_0000;0;_'
SET VAR vCaption TEXT = 'Example 01a'
CLS
DIALOG .vMessage vSSN=20 vEndKey 1 CAPTION .vCaption ICON 'APPS'
Example 02: (Capturing Phone Number)
SET VAR vPhone TEXT = NULL
CLS
DIALOG 'Enter Phone Number||(000) 000_0000;0;_' +
vPhone=20 vEndKey 1 CAPTION 'Example 02' ICON 'HELP'
Example 02a: (Capturing Phone Number)
SET VAR vPhone TEXT = NULL
SET VAR vMessage TEXT = 'Enter Phone Number||(000) 000_0000;0;_'
SET VAR vCaption TEXT = 'Example 02a'
CLS
DIALOG .vMessage vPhone=20 vEndKey 1 CAPTION .vCaption ICON 'HELP'
Example 03: (Capturing Zip Code)
SET VAR vZipCode TEXT = NULL
CLS
DIALOG 'Enter Zip Code||00000_0000;0;_' +
vZipCode=20 vEndKey 1 CAPTION 'Example 03' ICON 'QUESTION'
Example 03a: (Capturing Zip Code)
SET VAR vZipCode TEXT = NULL
SET VAR vMessage TEXT = 'Enter Zip Code||00000_0000;0;_'
SET VAR vCaption TEXT = 'Example 03a'
CLS
DIALOG .vMessage vZipCode=20 vEndKey 1 CAPTION .vCaption ICON 'QUESTION'
Example 04: (Capturing Credit Card Number)
SET VAR vCCNumber TEXT = NULL
CLS
DIALOG 'Enter Credit Card Number||0000_0000_0000_0000;0;_' +
vCCNumber=20 vEndKey 1 CAPTION 'Example 04' ICON 'WINDOWS'
Example 04a: (Capturing Credit Card Number)
SET VAR vCCNumber TEXT = NULL
SET VAR vMessage TEXT = 'Enter Credit Card Number||0000_0000_0000_0000;0;_'
SET VAR vCaption TEXT = 'Example 04a'
CLS
DIALOG .vMessage vCCNumber=20 vEndKey 1 CAPTION .vCaption ICON 'WINDOWS'