Progress
Language Reference


Trigger Phrase

Interfaces
OS
SpeedScript
All
All
No

Defines triggers on one or more user-interface events for a single user-interface component. Use the Trigger phrase within the statement that defines or creates the associated user-interface component.

SYNTAX

TRIGGERS:
  { ON event-list [ ANYWHERE ]
      {     trigger-block
         |  PERSISTENT RUN procedure
              [ IN handle ]
              [ ( input-parameters ) ]
      }
  } ... 
  END [ TRIGGERS ] 

event-list

The event or events with which the trigger block is associated. To specify more than one event, separate them with commas.

SYNTAX
event1 , event2 ... 

The events you can specify depend on the type of the associated widget. See the reference entry for the appropriate widget. For more information on each user interface event that Progress supports, see the "Events Reference".

ANYWHERE

Specifies that the trigger is a group trigger. This means that it applies not only to the widget being defined or created, but also is a default to any widget contained within that widget. This allows you to create a default trigger for all widgets in a frame or window. You can override the group trigger by defining a trigger on the same event specifically for the widget (or by defining a group trigger on an intervening widget).

trigger-block

A sequence of 4GL statements to be executed when any of the specified events occur. The trigger block must be a single 4GL statement or a DO block.

PERSISTENT RUN procedure [ IN handle ] [ ( input-parameters ) ]

Specifies a persistent trigger; that is, a trigger that remains in effect after the current procedure terminates. A persistent trigger must be a procedure specified by procedure. The trigger procedure can take one or more input parameters; it cannot have any output parameters. The parameters are evaluated when the trigger is defined. They are not re-evaluated each time the trigger executes.

If you specify the IN handle option, procedure must be the name of an internal procedure defined in the external procedure specified by handle, where handle is an expression that evaluates to a valid procedure handle. The external procedure must be in scope when you run procedure.

EXAMPLE

This procedure defines triggers for two buttons.

r-trigp.p
DEFINE FRAME cust-frame.
DEFINE QUERY custq FOR customer.

DEFINE BUTTON nextcust LABEL "Next"
   TRIGGERS:
      ON CHOOSE
          DO:
              GET NEXT custq.
              DISPLAY customer WITH FRAME cust-frame.
          END.
   END TRIGGERS.

DEFINE BUTTON prevcust LABEL "Previous"
   TRIGGERS:
      ON CHOOSE
          DO:
              GET PREV custq.
              DISPLAY customer WITH FRAME cust-frame.
          END.
   END TRIGGERS.

OPEN QUERY custq FOR EACH customer.

GET FIRST custq.
DISPLAY customer WITH FRAME cust-frame.

ENABLE nextcust AT COLUMN 1 ROW 7 prevcust WITH FRAME cust-frame.

WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW. 

NOTES

SEE ALSO

CREATE Widget Statement, DEFINE MENU Statement, ON Statement


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