Navigation: Language Reference > 9 - Window and Report Attributes > Window and Report Attributes >====== MASK (set pattern editing data entry) ====== | |
MASK
The MASK attribute (PROP:MASK) specifies pattern input editing mode for all controls in the window (when placed on the WINDOW statement). Toggling the value of PROP:MASK for a window only affects controls created after–it does not affect any existing controls.
Pattern input editing mode means that, as the user types in data, each character is automatically validated against the control's picture for proper input (numbers only in numeric pictures, etc.). This forces the user to enter data in the format specified by the control's display picture.
If MASK is omitted, Windows free-input is allowed in the controls. Free-input means the user's data is formatted to the control's picture only after entry. This allows users to enter data as they choose and it is automatically formatted to the control's picture after entry. If the user types in data in a format different from the control's picture, the libraries attempt to determine the format the user used, and convert the data to the control's display picture. For example, if the user types “January 1, 1995” into a control with a display picture of @D1, the runtime library formats the user's input to “1/1/95.” This action occurs only after the user completes data entry and moves to another control. If the runtime library cannot determine what format the user used, it will not update the USE variable. It then beeps and leaves the user on the same control with the data they entered, to allow them to try again.
The MASK attribute controls the input to ENTRY/COMBO/SPIN controls. If the control does not have input focus, the value of its USE variable is displayed according to the control's picture, regardless of the presence or absence of the MASK attribute. If the USE variable is equal to zero (0) and the control's picture is of @D, @T or @P type without the B modifier, the displayed text is not blank. To blank it, the B modifier must be used in the control's picture.
The MASK attribute can be used for individual ENTRY/SPIN/COMBO controls rather than for all such controls if the MASK attribute is set for a WINDOW.
Example:
!A Window with pattern input editing enabled
Win2 WINDOW,MASK
END
!Window with controls with pattern input editing enabled
Win2 WINDOW,MASK
COMBO(@P(###) ###-####P),AT(120,120,20,20),USE(Phone),FROM(Q1:F2)
SPIN(@N8.2),AT(280,0,20,20),USE(SpinVar1),FROM(Q)
ENTRY(@D2),AT(100,200,20,20),USE(DateField)
END