Programming Guide : 11. Managing Event Queues : Event-based Programming
 
Share this page                  
Event-based Programming
An important concept to keep in mind when planning your OpenROAD scripts is that users' actions, rather than the order of your code, control the flow of the application.
In most cases, the code you provide for a particular event is executed only when the user triggers that event from the user interface. Depending on how the user interacts with the application, the order in which the events are triggered may differ and some events may not be triggered at all.
The following diagram illustrates the order in which the events are placed into the application event queue if the user clicks Button A, Button B, Button C, and Button D, in that order, from three different frames:
In this example, the events execute in the same order in which they are placed on the application event queue. However, events can execute in a different order when external or user events are being sent. When a frame is blocked (for example, by a WaitFor), external and user events are still delivered. They are not executed until the event that the frame is waiting for arrives. Events that occur later in time for unblocked frames execute before the earlier events of the blocked frame.
You should not rely on the sequence of events as a means of simulating the effect of a local procedure. To avoid duplication of code, use a local procedure instead of sending a user event to the current frame.