MaskedEdit Control

[This is preliminary documentation and subject to change.]

This is an edit field control with a mask contained in the text field of the control. The MaskedEdit Control can be used to create a template for user entry of information such as a phone number or Product ID code. For example, the PIDKEY property can be entered by the user through a MaskedEdit Control that has been specified by setting the PIDTemplate property to a string such as:

12345<### -%%%%%%%>@@@@@

This string defines the masking template for the entry of the PIDKEY property by the user.

The syntax of the mask is a described below. The visible segment of the string is enclosed by the pair of <> characters.

< This is the left end of the visible segment of the template. This character and everything to its left is hidden in the user interface. There should be no more than one instance of this character in the template.
> This is the right end of the visible segment of the template. This character and everything to its right is hidden in the user interface. This character is replaced by a dash during validation. If there is a visible segment started with <, then it must be terminated with a matching >.
# This character is a digit.
% An alternate digit, essentially the same as # , enabling a custom action to differentiate between fields in a way that can be controlled by the mask.
@ This character is a randomized digit. This character should not appear in the visible part of the template.
_ This character stands for an alpha-numeric character.
^ An alternate alpha-numeric character, enabling a custom action to differentiate between fields in a way that can be controlled by the mask..
? An alternate alpha-numeric character.
' An alternate alpha-numeric character.
= This character is the field terminator. This must follow a #, %, ^, or '. This creates one more input position of the same type as the preceding positions and terminates the field with a '-' separator.

Any other character is treated as a literal constant.

For the characters that can be edited the control creates separate edit windows with one window for each block of contiguous characters of the same kind.

Property

The property associated with this control must be a string.

Valid Style Bits

Enabled
Indirect
Sunken
Visible

Valid Control Attributes

Default
Enabled
Indirect
IndirectPropertyName
Position
PropertyName
PropertyValue
Text
Visible
WindowHandle

Control Events Published

None.

Can Take Focus

Yes.

Remarks

The control creates one parent window of the "BUTTON" class with the BS_OWNERDRAW and WS_EX_CONTROLPARENT styles. It creates several child windows to this window: for the constant text parts it creates "STATIC" windows with the SS_LEFT and WS_CHILD styles. For the editable fields it creates an "EDIT" window with the WS_CHILD, WS_BORDER and WS_TABSTOP styles. In case of a numeric field the window also has the ES_NUMBER style.

The alternate digit, %, and alternate alpha-numeric characters, ^, ?, and ' fields are intended to allow custom actions differentiate between fields in a way that can be controlled by the mask. For example, ^ could be used for fields that should be upper-case.