How You Can Communicate Between Frames Using User Events
You can utilize user events to communicate between two frames by performing the following basic steps:
1. Write the event block for the user event in one frame script.
The event block for the user event contains the code that is executed when the user event is triggered.
2. Include in the other frame script the SendUserEvent method to trigger the user event in the first frame.
When the SendUserEvent method is executed, OpenROAD places the specified user event in the native event queue. From there, OpenROAD dispatches the user event to the appropriate frame. The code for the user event is executed when the event reaches the top of the frame's event queue. The following illustration demonstrates this:
You can also have one frame send a user event to itself. For example, a frame that displays a clock can send an event to itself at regular intervals to update the clock. For an example of this, see
Delay Parameter (see
Delay Parameter).
Because the events in event queues are processed one at a time, the event block that places the user event in the native event queue (that is, the event block that contains the SendUserEvent method) completes before the user event is processed. If you want to force the event block that sends the user event to complete after a specified user event, use the WaitFor method. The WaitFor method prevents the current event block from being executed until the current frame receives the specified user event. For more information, see
WaitFor Method (see
WaitFor Method).
If necessary, you can remove a user event from an event queue with the PurgeUserEvent method. For more information, see
PurgeUserEvent Method (see
PurgeUserEvent Method).