Release 10.1A: OpenEdge Development:
Progress 4GL Handbook

> ## Triggers as event-driven code

> There’s one important thing to note about the trigger blocks. In Chapter 1, "Introducing the Progress 4GL," you learned that language statements are generally executed or processed in the order in which they appear in the procedure. Now you need to think about the difference between statements being executed and statements merely being processed. Definitional statements such as the `DEFINE VARIABLE` and `DEFINE BUTTON` statements aren’t executed at all. They just tell Progress to set up the structures they define for later use. The trigger blocks, however, are executable blocks of code, but they aren’t executed when they’re first encountered. They are just set up to be executed when the event they are defined for occurs. You can think of the Progress compiler marching down through the procedure and defining the r-code for each executable statement in sequence. When it encounters a trigger block, it sets aside a special part of the r-code with those statements in it, keyed by the event that triggers the code.

> This concept is fundamental to the nature of OpenEdge applications. These applications are called event-driven, because to a large extent the procedures in the application just set up blocks of code, and even entire procedures, to be available in memory when user-initiated events call for them.

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