PreviousNextIndex

ENABLE statement

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 ...]
UNLESS-HIDDEN
field
format-phrase
WHEN expression
TEXT
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
Example

The following example enables the CustNum field and the Quit button in the main procedure. If you press GO in the CustNum field and successfully find a record, the trigger disables the CustNum field and enables the CreditLimit field and the Save and Undo buttons. If you choose Save or Undo, the CHOOSE trigger disables the buttons and enables the CustNum 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_quit 
  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.CreditLimit WITH FRAME cust-info. 
  ENABLE Customer.CustNum WITH FRAME cust-info. 
  IF SELF:LABEL = "save" THEN 
    ASSIGN FRAME cust-info Customer.CreditLimit. 
  CLEAR FRAME cust-info NO-PAUSE. 
  APPLY "ENTRY" TO Customer.CustNum IN FRAME cust-info. 
END. 
ON GO OF Customer.CustNum IN FRAME cust-info DO: 
  FIND Customer USING Customer.CustNum EXCLUSIVE NO-ERROR. 
  IF AVAILABLE Customer THEN DO: 
    DISABLE Customer.CustNum WITH FRAME cust-info.  
    ENABLE Customer.CreditLimit WITH FRAME cust-info. 
    ENABLE ALL WITH FRAME butt-frame. 
    DISPLAY Customer WITH FRAME cust-info. 
  END. 
  ELSE DO: 
    MESSAGE "No customer record exists for customer number" 
      INPUT Customer.CustNum ", 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.CustNum WITH FRAME cust-info. 
ENABLE b_quit WITH FRAME butt-frame. 
WAIT-FOR CHOOSE OF b_quit IN FRAME butt-frame 
  FOCUS Customer.CustNum IN FRAME cust-info.  

Notes
See also

DISABLE statement, WAIT-FOR statement (ABL only)


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex