The Phoebus library allows you to use masks during editing. Masks provide restricted data input as well as formatted data output. The sections in this topic provide general information on the mask functionality:
Phoebus cho phép bạn sử dụng mặt nạ nhập liệu trong suốt quá trình chỉnh sửa. Với mặt nạ nhập liệu, dữ liệu nhập vào phải tuân theo định dạng đã được định nghĩa từ trước. Các phần trong chủ đề này cung cấp những thông tin chung về chức năng mặt nạ nhập liệu.
You can use masks if you need to ensure that end-users enter values only in a particular form. Masks are in effect only in edit mode. When an editor is not in edit mode its display text is formatted according to the editor's RepositoryItem.DisplayFormat format.
Bạn có thể dùng mặt nạ nhập liệu nếu bạn cần đảm bảo rằng người dùng cuối nhập vào các giá trị chỉ trong một hình thức đặt biệt. Mặt nạ nhập liệu chỉ có hiệu lực trong chế độ chỉnh sửa. Khi người dùng không ở trong chế độ chỉnh sửa
The LookUpEdit, GridLookUpEdit, MemoEdit, MemoExEdit and ImageComboBoxEdit controls do not support editing in masked mode.
Using masks in editors is useful when the entered string should match a specific format. For instance, a text editor should accept date/time values in 24-hour format only, or only numeric values. Another example is entering a phone number within an editor (an end-user needs to enter only digits, while hyphens should be automatically skipped while editing). To support these and many other data input formats the masked mode can be used.
An editor's mask settings can be accessed via the RepositoryItemTextEdit.Mask property of the editor's TextEdit.Properties object. The RepositoryItemTextEdit.Mask property represents an instance of the MaskProperties class and this contains mask settings (mask type, mask, whether the mask's literal characters should be saved to the edit value, etc).
At design time you can use the Mask Editor to customize the mask settings. The editor provides multiple predefined masks. It's also possible to create custom masks. The editor's Test Input box allows you to test the selected mask. To invoke the editor click the ellipsis button (...) for the RepositoryItemTextEdit.Mask property in the Properties grid.
|
To enable masked input select the required mask type via the MaskProperties.MaskType property and specify a mask string via the MaskProperties.EditMask property. A mask string identifies a data input pattern. You can use either predefined mask strings or compose your own mask expressions. Mask strings should be set according to the mask type, the available mask types are listed in the following table:
|
The MaskProperties class that encapsulates the mask functionality provides a number of additional customization settings. The following table lists which options are in effect for various mask types (such options are indicated using the
|