Controlling and Masking User Input

From RAD Studio
Jump to: navigation, search

Go Up to Setting Persistent Field Properties and Events


The EditMask property provides a way to control the type and range of values a user can enter into a data-aware component associated with TStringField, TDateField, TTimeField, and TDateTimeField, and TSQLTimeStampField components. You can use existing masks or create your own. The easiest way to use and create edit masks is with the Input Mask editor. You can, however, enter masks directly into the EditMask field in the Object Inspector.

Note: For TStringField components, the EditMask property is also its display format.

To invoke the Input Mask editor for a field component

  1. Select the component in the Fields editor or Object Inspector.
  2. Click the Properties page in the Object Inspector.
  3. Double-click the values column for the EditMask field in the Object Inspector, or click the ellipsis button. The Input Mask editor opens.

The Input Mask edit box lets you create and edit a mask format. The Sample Masks grid lets you select from predefined masks. If you select a sample mask, the mask format appears in the Input Mask edit box where you can modify it or use it as is. You can test the allowable user input for a mask in the Test Input edit box.

The Masks button enables you to load a custom set of masks - if you have created one - into the Sample Masks grid for easy selection.

See Also