ENABLE statement
Enables input for one or more field-level and child frame widgets within a frame.
Data movement
Syntax
ALL [ EXCEPTfield
...]UNLESS-HIDDENfield
Specifies the name of the field, variable, or widget you want to enable. Remember that the ENABLE statement accepts input only and stores it in the screen buffer. The underlying record buffer of a field or variable is unaffected unless you ASSIGN the value.In array fields, array elements with constant subscripts are treated just like any other field. Array fields with no subscripts or array fields in the FORM statement are expanded as though you had entered the implicit elements. See the DISPLAY statement reference entry for information on how array fields with expressions as subscripts are handled.Note: You cannot enable unfixed indeterminate array variables.format-phrase
Specifies one or more frame attributes for a field, variable, or expression. For more information onformat-phrase
, see the Format phrase reference entry.WHENexpression
TEXT
Defines a group of character fields or variables (including array elements) to use automatic text-wrap. The TEXT option works only with character fields. When you insert data in the middle of a TEXT field, the AVM wraps data that follows into the next TEXT field, if necessary. If you delete data from the middle of a TEXT field, the AVM wraps data that follows into the empty area.If you enter more characters than the format for the field allows, the AVM discards the extra characters. The character fields must have formats in the form x(n). A blank in the first column of a line marks the beginning of a paragraph. Lines within a paragraph are treated as a group and will not wrap into other paragraphs.constant
[ ATn
| TOn
] [ BGCOLORexpression
] [ DCOLORexpression
]
[ FGCOLORexpression
] [ FONTexpression
] [ PFCOLORexpression
]
[ VIEW-AS TEXT ]
Specifies a constant (literal) value that you want displayed in the frame. If you use the AT option,n
is the column in which you want to start the display. If you use the TO option,n
is the column in which you want to end the display. You can use the BGCOLOR and FGCOLOR options in graphical interfaces to define the foreground and background colors to use when the constant is displayed. Similarly, you can use the DCOLOR and PFCOLOR options in character interfaces to define the prompt and display colors to use when the constant is displayed. The font option, for both character and graphical interfaces, defines the font used. If you use the VIEW-AS TEXT option, the constant is displayed as a text widget rather than a fill-in field.SPACE [ (n
) ]
Identifies the number (n
) of blank spaces to insert after the field displays. Then
can be 0. If the number of spaces you specify is more than the spaces left on the current line of the frame, the AVM starts a new line and discards any extra spaces. If you do not use this option orn
, the AVM inserts one space between items in the frame.SKIP [ (n
) ]
Identifies the number (n
) of blank lines to insert after the field is displays. Then
can be 0. If you do not use this option, the AVM does not skip a line between expressions unless the expressions do not fit on one line. If you use the SKIP option, but do not specifyn,
or ifn
is 0, the AVM starts a new line unless it is already at the beginning of a new line.^IN WINDOWwindow
frame-phrase
The frame that contains the widgets to enable. If you omitframe-phrase
, the default frame for the current block is assumed. For more information onframe-phrase
, see the Frame phrase reference entry.ExampleThe following example enables the
CustNum
field and the Quit button in the main procedure. If you press GO in theCustNum
field and successfully find a record, the trigger disables theCustNum
field and enables theCreditLimit
field and the Save and Undo buttons. If you choose Save or Undo, the CHOOSE trigger disables the buttons and enables theCustNum
field again. Note that if you choose the Save button, the trigger must execute an ASSIGN statement to set the value in the underlying database field.
Notes
- For field representation widgets, the ENABLE statement lets you change the widget’s SCREEN-VALUE. If you want to save changes to the field itself, you must subsequently use the ASSIGN statement.
During data entry, a validation expression defined for the field in the database or in a Format phrase executes only if the widget associated with the field receives input focus. Use the VALIDATE( ) method to execute a validation expression defined for a field regardless of whether it receives input focus or not.- If you invoke the ENABLE statement for a frame, the AVM brings the frame into view unless the HIDDEN attribute for the frame or one of its ancestor frames or windows is TRUE.
- If you invoke the ENABLE statement for the parent frame of a frame family, the field representation widgets and descendant frames owned by the parent frame are all enabled. However, the field representation widgets of the descendant frames remain disabled and visually insensitive. To enable field representation widgets in the descendant frames and make them sensitive, you must invoke ENABLE statements for each of the descendant frames.
- If you specify the KEEP-TAB-ORDER option for a frame, the ENABLE statement has no affect on the tab order for the frame. Otherwise, the ENABLE statement can affect the tab order of widgets within the frame.
- The tab order for fields specified by the ENABLE statement replaces any conflicting tab order established by previous ENABLE statements or by previous settings of the FIRST-TAB-ITEM, LAST-TAB-ITEM, MOVE-AFTER-TAB-ITEM, or MOVE-BEFORE-TAB-ITEM attributes and methods.
- If you specify the ALL option with the ENABLE statement, the tab order of fields corresponds to the order they are specified in the frame definition. Also, the Data Dictionary field validations and help messages are compiled for all fields in the frame, including view-only fields (for example, text widgets).
- If you specify the ENABLE statement with
field
parameters, the specified fields are moved in the tab order to the end of the order specified for the original frame definition, and the tab order of eachfield
corresponds to the order in which it is specified in the statement. The following code enables three widgets (a, b, and c) in frame A with the tab order d, e, f, a, b, and c:
Note: Note that widgets d, e, and f are not accessible until their SENSITIVE attributes are set to TRUE.- If you use more than one ENABLE statement to enable widgets within a frame, each widget is added to the end of the tab order as it is enabled. For example, the following code enables three widgets in a frame:
This code sets the tab order as a b c. Rearranging the ENABLE statements changes the tab order.- For SpeedScript, these options are invalid: BGCOLOR, DCOLOR, FGCOLOR, FONT, IN-WINDOW.
See also
OpenEdge Release 10.2B
|