Progress
Language Reference


ENABLE Statement

Interfaces
OS
SpeedScript
All
All
Yes

Enables input for one or more field-level and child frame widgets within a frame.

DATA MOVEMENT

SYNTAX

ENABLE [ UNLESS-HIDDEN ]
  {    ALL [ EXCEPT field ... ]
     | {   field [ format-phrase ] [ WHEN expression ]
         | TEXT ( { field [ format-phrase ]
             [ WHEN expression ] } ... )
         | constant [ AT n | TO n ]
             [ BGCOLOR expression ]
             [ DCOLOR expression ]
             [ FGCOLOR expression ]
             [ FONT expression ]
             [ PFCOLOR expression ]
             [ VIEW-AS TEXT ]
         | SPACE [ ( n ) ]
         | SKIP [ ( n ) ]
        } ...
   }
  [ IN WINDOW window ] [ frame-phrase ] 

ALL [ EXCEPT field ...]

Specifies that all field-level widgets for a frame are enabled, except those you list.

UNLESS-HIDDEN

Restricts ENABLE to fields whose HIDDEN attribute is FALSE.

field

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 window 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.

format-phrase

Specifies one or more frame attributes for a field, variable, or expression. For more information on format-phrase, see the Format Phrase reference entry.

WHEN expression

Enables the field only if expression has a value of TRUE when the ENABLE statement is executed. Here, expression is a field name, variable name, or expression that evaluates to a LOGICAL value.

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, Progress wraps data that follows into the next TEXT field, if necessary. If you delete data from the middle of a TEXT field, Progress wraps data that follows into the empty area.

If you enter more characters than the format for the field allows, Progress 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 [ AT n | TO n ] [ BGCOLOR expression ] [ DCOLOR expression ]
[ FGCOLOR expression ] [ FONT expression ] [ PFCOLOR expression ]
[ 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. The n can be 0. If the number of spaces you specify is more than the spaces left on the current line of the frame, Progress starts a new line and discards any extra spaces. If you do not use this option or n, Progress inserts one space between items in the frame.

SKIP [ (n) ]

Identifies the number (n) of blank lines to insert after the field is displays. The n can be 0. If you do not use this option, Progress 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 specify n, or if n is 0, Progress starts a new line unless it is already at the beginning of a new line.

^

Tells Progress to ignore an input field when input is being read from a file.

IN WINDOW window

Specifies the window in which the widgets are enabled. The window parameter must be the name of a currently defined window or an expression that evaluates to the handle for a currently defined window.

frame-phrase

The frame that contains the widgets to enable. If you omit frame-phrase, the default frame for the current block is assumed. For more information on frame-phrase, see the Frame Phrase reference entry.

EXAMPLE

The following example enables the cust-num field and the Quit button in the main procedure. If you press GO in the cust-num field and successfully find a record, the trigger disables the cust-num field and enables the credit-limit field and the Save and Undo buttons. If you choose Save or Undo, the CHOOSE trigger disables the buttons and enables the cust-num 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.

r-enable.p
DEFINE VARIABLE ok AS LOGICAL NO-UNDO.

DEFINE BUTTON b_quit LABEL "Quit" AUTO-ENDKEY. 
DEFINE BUTTON b_save LABEL "Save".
DEFINE BUTTON b_undo LABEL "Undo".

DEFINE FRAME butt-frame
  b_save b_undo b_quittt
  WITH CENTERED ROW SCREEN-LINES - 2.
  
FORM
  customer
WITH FRAME cust-info SIDE-LABELS CENTERED
    TITLE "Update Customer Credit Limit".

ON CHOOSE OF b_save, b_undo IN FRAME butt-frame
DO:
  DISABLE b_save b_undo WITH FRAME butt-frame.
  DISABLE customer.credit-limit WITH FRAME cust-info.
  ENABLE customer.cust-num WITH FRAME cust-info.
  IF SELF:LABEL = "save" THEN
    ASSIGN FRAME cust-info customer.credit-limit.
  CLEAR FRAME cust-info NO-PAUSE.
  APPLY "ENTRY" TO customer.cust-num IN FRAME cust-info.
END. 
ON GO OF customer.cust-num IN FRAME cust-info
DO:
  FIND customer USING customer.cust-num EXCLUSIVE NO-ERROR.
  IF AVAILABLE(customer) THEN
  DO:
    DISABLE customer.cust-num WITH FRAME cust-info. 
    ENABLE customer.credit-limit WITH FRAME cust-info.
    ENABLE ALL WITH FRAME butt-frame.
    DISPLAY customer WITH FRAME cust-info.
  END.
  ELSE
  DO:
     MESSAGE "No Customer Record exist for customer number"
             INPUT customer.cust-num ", Please re-enter."
       VIEW-AS ALERT-BOX WARNING BUTTONS OK-CANCEL UPDATE OK.
    IF NOT ok THEN
      APPLY "CHOOSE" TO b_quit IN FRAME butt-frame. 
  END.
END.

ENABLE customer.cust-num WITH FRAME cust-info.
ENABLE b_quit WITH FRAME butt-frame.
WAIT-FOR CHOOSE OF b_quit IN FRAME butt-frame
   FOCUS customer.cust-num IN FRAME cust-info.  

NOTES

SEE ALSO

DISABLE Statement, WAIT-FOR Statement


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095