programming:programming_in_openinsight:programmatic_control_and_manipulation_of_event_processing

Programmatic control & manipulation of event processing

Since User code is always processed first in response to a given event, you have complete flexibility to either programmatically trigger other events and their event handlers, or to run processes before and/or after the System Event Handler for the current event. You can manipulate the chain of event processing by using the Send_Event function, or the Forward_Event and Post_Event system subroutines in User code.

SEND_EVENT

Send_Event(), called from a currently executing User code, triggers a DIFFERENT event.

For example a menu command's event handler could send the CLICK event to a push button, or a push button's CLICK event could send the READ event to a window. All User code and System Event Handlers for the recipient control or window event then execute according to the normal chain of event processing as described in the topic Understanding Standard Event Handlers and Processes.

FORWARD_EVENT

Forward_Event, called from currently executing User code "forwards" the SAME event on through the event processing chain, and then returns control to the next line of User code in the original event handler. The most common reason to do this is to permit event pre- and post-processing.

A common example is the READ event. In User code, which executes first, you can call any desired pre-read routines. Calling Forward_Event forwards the SAME event on through the System Event Handlers (i.e., the actual read). After the read, control returns to your User code, and you can then call any post-read routines before ending your event handler with a RETURN 0 statement.

POST_EVENT

Don't confuse the Post_Event() function with the concept of event post-processing as described above for Forward_Event. Rather, think of Post_Event() as "posting" an event handler call on a bulletin board for later use.

Calling Post_Event() in currently executing User code:

  • allows: you to complete all processes in the currently executing event handler;
  • allows the current event handler to terminate;
  • immediately triggers another event and its associated User code and system level processes

This contrasts with Forward_Event in which all processes take place before the currently executing User code terminates.

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