EVENT (return event number)

Top  Previous  Next

 

EVENT( )

The EVENT procedure returns a number indicating what caused ACCEPT to alert the program that something has happened that it may need to handle. There are EQUATEs listed in EQUATES.CLW for all the events the program may need to handle.

There are two types of events generated by ACCEPT: field-specific and field-independent events. Field-specific events affect a single control, while field-independent events affect the window or program. The type of event can be determined by the values returned by the ACCEPTED, SELECTED, and FIELD procedures. If you need to know which field has input focus on a field-independent event, use the FOCUS procedure.

For field-specific events:

The FIELD procedure returns the field number of the control on which the event occurred. The ACCEPTED procedure returns the field number if the event is EVENT:Accepted. The SELECTED procedure returns the field number if the event is EVENT:Selected.

For field-independent events:

The FIELD, ACCEPTED, and SELECTED procedures all return zero (0).

Return Data Type:

SIGNED

Example:

ACCEPT

CASE EVENT()

OF EVENT:Selected

 CASE SELECTED()

 OF ?Control1

  !Pre-edit code here

 OF ?Control2

  !Pre-edit code here

 END

OF EVENT:Accepted

 CASE ACCEPTED()

 OF ?Control1

  !Post-edit code here

 OF ?Control2

  !Post-edit code here

 END

END

END

 

See Also:

ACCEPT

FIELD

FOCUS

ACCEPTED

SELECTED

Modal Events

POST