11. 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 (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 (see Inter-Frame Communication Techniques) and WaitFor Method (see WaitFor Method)).
Note:  Using the WaitFor method to wait for events sent to the current frame causes the wait to last forever.