Input Mask editor

From RAD Studio
Jump to: navigation, search

Go Up to Property Editors Index

Use the Input Mask editor to define an edit box that limits the user to a specific format and accepts only valid characters. For example, in a data entry field for telephone numbers, you might define an edit box that accepts only numeric input. If a user then tries to enter a letter in this edit box, your application will not accept it.

Use the Input Mask editor to edit the Vcl.Mask.TCustomMaskEdit.EditMask property of the MaskEdit component.

Opening the Input Mask editor

To open the Input Mask editor:

  1. Place a TMaskEdit component on the form.
  2. With that component selected, do one of the following:
    • Click the ellipsis button in the Value column for the EditMask property.
    • Double-click the Value column for the EditMask property.

Input mask

Define your own masks for the edit box. You can use a special character to specify the mask; for a listing of those characters, see the TEditMask datatype.

The mask consists of three fields separated by semicolons. The three fields are:

  • The mask itself; you can use predefined masks or create your own.
  • The character that determines whether or not the literal characters of the mask are saved as part of the data.
  • The character used to represent a blank in the mask.

Character for Blanks

Specify a character to use as a blank in the mask. Blanks in a mask are areas that require user input.

This edit box changes the third field of your edit mask.

Save Literal Characters

Check to store the literal characters from the edit mask as part of the data. This option affects only the Mask.TCustomMaskEdit.Text property of the MaskEdit component. If you save data using the Vcl.Mask.TCustomMaskEdit.EditText property, literal characters are always saved.

This check box toggles the second field in your edit mask.

Test Input

Use Test Input to verify your mask. This edit box displays the edit mask as it will appear on the form.

Sample Masks

Select a predefined mask to use in the MaskEdit component. When you select a mask from this list, the product places the predefined mask in the Input Mask edit box and displays a sample in the Test Input edit box. To display masks appropriate to your country, choose the Masks button.

Masks button

Choose Masks to display the Open Mask File dialog box, where you choose a file containing the sample masks shown in the Sample Masks list box.

See Also