Programming Guide : Managing Event Queues : Event-based Programming : Order of Events: Event Queues
 
Share this page          
Order of Events: Event Queues
OpenROAD processes a separate queue for each active frame. If there are two or more concurrently active frames, there is no guarantee as to the order in which the frame queues are processed. Therefore, if you send a user event to more than one active frame, you cannot assume that the order of sending is the order of processing.
Within a queue, events are processed on a First In First Out (FIFO) basis. When OpenROAD processes the frame queue, it finishes executing the current event block before executing the next event in the queue.
By default, when the event is being executed, all open frames are blocked so that the user cannot select ahead and trigger more events. However, you can change this behavior by setting the BlocksFrames attribute to FALSE. For more information about the BlocksFrames attribute, see How You Can Block an Open Frame.
Example:
The following sample event block from the video_detail frame includes the SendUserEvent method, which triggers the specified user event. When OpenROAD executes this method, the following happens:
1. It sends the UpdateTitle user event to the application event queue and finishes executing the SetValue event block.
2. When the UpdateTitle event reaches the top of the application event queue, it places this event on the frame queue for the graphic_frame frame.
3. It executes the code associated with the UpdateTitle user event only after that event reaches the top of the frame queue.
on setvalue video.title =
begin
   CurFrame.WindowTitle = video.title;
   if graphic_frame is not null then
      graphic_frame.SendUserEvent
      (eventname = 'UpdateTitle',
      messagevarchar = video.title);
   endif;
end
To force the current event block to wait until a specified user event has arrived, you can use the WaitFor method (for more information about user events and the WaitFor method, see Inter-Frame Communication Techniques and WaitFor Method.
Note:  Using the WaitFor method to wait for events sent to the current frame causes the wait to last forever.
How You Can Examine and Manipulate Event Queues
When you are debugging an application, you can manipulate an event before it occurs. The OpenROAD Debugger lets you set break conditions on events, causing the application to pass control to the Debugger immediately before executing the specified event. For more information, see Debugging Your Application.
You can also examine the sequence of events in the Debugger's Event Queue window. This window displays the contents of a given frame's event queue. For more information about debugging events and the event queue, see Debugging Your Application.