programming:programming_in_openinsight:understanding_standard_event_handlers_and_processes

Understanding Standard Event Handlers and Processes

OpenInsight features three basic types of Event Handlers:

User Defined Code

BASIC+ event handler code written by the application developer using the Form Designer's Event Editor. User code always executes first in the chain of event handling processes.

System Event Handlers

A default (i.e. system-level) event handler attached to a given event, the execution of which occurs at the system level, and the functionality of which is pre defined. For example the System Event Handler for a READ event actually goes out and reads a row from a table. The application developer, though not having direct control over what happens in System Event Handlers, can control whether (and sometimes when) these execute.

Quick Event Handlers

An event handler defined non procedurally by the application developer using the QuickEvent Builder tool in the Form Designer. To get the behavior you want and expect from controls and windows, you must understand what the different types of event handlers are, in what order they normally execute after an event occurs, and how you, the developer, can control and manipulate the various levels of processing.

Event handling processes follow a pre-defined logical chain after an event happens. Processing begins with User Code. It then moves down through any System Event Handlers and finishes with QuickEvents. The process of moving through these various levels of processing is called EVENT CHAINING. For a better understanding of how event processing flows, study the diagram illustrating the default event chain process for flow of event handling.

System Level (default) event processing

Some events have a default SYSTEM EVENT HANDLER attached to them, while others depend solely upon you to supply event handling code. System Event Handlers, as the name implies, happen at the system level and you, the application developer, do not have direct control over the functionality. For example, the System Event Handler for a WRITE event actually goes out and writes a row to a table. Processes like Data Validation take place at this level also. The technical details about how this logic layer actually works are beyond the scope of this document. What is important is that you understand what basic processes happen there, where System Event Handlers come into play in event handling, and how the processing flows before, during. and after encountering a System event Handler. All events adhere to the general rule for event handling process flow. Some events have System Event Handlers attached to them while others do not. System Event Handler processes are not the same for every event. Different things happen in the System Event Handler for the READ event than happen for a CLOSE event, for example.

Understanding event chaining.

To achieve the desired behavior from your windows and controls, you need to understand the standard chain of event handling, what happens at the system level (if event handling chains down that far), and finally, when or whether the event will FORWARD through the event chain to the next level of event handling. The event handling chain always begins with User code. The code you write controls whether or not the event will progress through the event handling chain or stop at the User code level. If no User code exists, the event forwards through the event chain as described earlier.

Variations in event chaining

All events follow the standard chain of event handling. However, some events may appear to vary from the norm. This is because of what happens in the System Event Handler for these events. Because of their intrinsic functionality, some events always forward through the chain if no errors occur in the System Event Handler for the event. The following topics illustrate what happens in the System Event Handlers for several events:

READ

WRITE

CLEAR

LOSTFOCUS, POSCHANGED

Note: You can also access these topics from the general rule diagram by clicking on the System E.H. process box. The CLOSE event forwards first, to check for and execute any QuickEvent, after which its System Event Handler executes.

Several events skip the System Event Handler altogether if a QuickEvent exists for them. These are:

HELP

OPTIONS

NOTES

  • programming/programming_in_openinsight/understanding_standard_event_handlers_and_processes.txt
  • Last modified: 2024/06/19 20:20
  • by 127.0.0.1