Event procedures and exception procedures dfferences

0 Likes

Problem:

What are the differences between event procedures and exception procedures?

When is it best to use event procedure and when to use exception procedure?  

Resolution:

The key differences between Event Procedures and Exception Procedures are:

Event Procedure does not terminate the Accept; Exception Procedure does.  

Event Procedure does not automatically update working-storage; Exception Procedure does.

There are mechanisms which allow you to terminate an ACCEPT from within an Event Procedure -( Set Event-Action-Terminate to true )- and mechanisms that allow you to update working storage from within an Event Procedure -( Inquire [control] [property] in [working-storage-variable])-.

These must be done programmatically, in an Event Procedure, where they are handled automatically in an Exception Procedure.

Use an exception procedure when you want to break out of an ACCEPT, use an event procedure when you don't.

To act on a MSG event, an event procedure must be used.  MSG events are generated by the Windows API.  By default, the runtime receives the information and updates the EVENT-STATUS data structure, but takes no further action.

To act on CMD and NTF events, it is usually preferable to use an exception procedure.

Use an exception procedure to display a screen or call a program.  This avoids recursion issues (ACCEPTs inside of ACCEPTs).

Use exception procedures if you want Working-Storage to be updated.

Old KB# 2683
Comment List
Related
Recommended