The EditMask edit style

Sometimes users need to enter data that has a fixed format. For example, in North America phone numbers have a 3-digit area code, followed by three digits, followed by four digits. You can define an edit mask that specifies the format to make it easier for users to enter values.

Edit masks consist of special characters that determine what can be entered in the column. They can also contain punctuation characters to aid users.

For example, to make it easier for users to enter North American phone numbers in the proper format, specify this mask:

(###) ###-####

During execution, the punctuation characters display in the box and the cursor jumps over them as the user types.

Figure 21-4: Example of EditMask edit style display before data entry

The sample shows a text box with the label Phone. The text box is empty except for parentheses, which provides a format for an area code to be entered by the user..

Special characters and keywords

Edit masks use the same special characters as display formats, and there are special considerations for using numeric, string, date, and time masks.

For information, see “Defining display formats”.

Keyboard behavior

Note that certain keystrokes from the SIP in edit masks behave as follows:

Also, note this behavior in Date edit masks:

Using the Mask pop-up menu

Click the button to the right of the Mask box on the Mask properties page to display a list that contains complete masks, as well as special characters that you can use to construct your own mask. For example, the menu for a Date edit mask contains complete masks such as mm/dd/yy and dd/mmm/yyyy. It also has components such as dd and jjj (for a Julian day). You might use these to construct a mask like dd-mm-yy, typing in the hyphens as separators.You cannot use a partial mask, such as dd or mmm, in a date edit mask. Any mask that does not include any characters representing the year will be replaced by a mask that does.

Using spin controls

You can define an edit mask as a spin control, which is a box with up and down arrows that users can click to cycle through fixed values. For example, you can set up a code table that provides the valid entries in a column; users simply click an arrow to select an entry. Used this way, a spin control works like a drop-down list that displays one value at a time.

For more about code tables, see “Defining a code table”.

Figure 21-5: Effect of clicking arrow on a spin control edit mask

The sample shows a spin control displaying the name of the  Software Development department. The spin control has a pair of up and down arrows inside the right edge of a text box. The user clicks one of the arrows, and the  spin  control displays the next sample value. In this picture, the next value displayed is Business Services.

StepsTo use an EditMask edit style:

  1. Select EditMask in the Style Type box if it is not already selected.

  2. Define the mask in the Mask box.

    You can select a named style in the Style Name box, which automatically places an edit mask in the mask box, or you can click the button to the right of the Mask box, then click the special characters that you want from the pop-up menu to use them in the mask. You can also type a mask in the Mask box.

  3. Specify other properties for the edit mask.

    When you use your EditMask, check its appearance and behavior. If characters do not appear as you expect, you might want to change the font size or the size of the EditMask.