SendUserEvent Method
Use the SendUserEvent method to trigger the user event in a frame. When the user event is triggered, OpenROAD adds it to the application's native event queue. If the frame is active, OpenROAD queues the user event immediately. If the frame is inactive because it has called another frame or procedure, OpenROAD waits until the frame becomes active again before it queues the user event. The message parameters of the SendUserEvent method let you send data to the receiving frame.
The syntax of the SendUserEvent method is:
FrameExec_var.SendUserEvent(eventname = varchar,
messageobject = object, messageinteger = integer,
messagefloat = float, messagevarchar = varchar,
delay = float, focusbehavior = integer,
errorevent = varchar)
The following example uses the SendUserEvent method to send the Flushvalues event to a child frame.
...
begin
...
childframe.SendUserEvent
(eventname = 'Flushvalues',
messageobject = CurFrame,
errorevent='WaitForEvent');
end;
To specify the frame that contains the user event you want to trigger, you must reference the FrameExec variable for the running instance of the frame. (You cannot use the frame name because OpenROAD allows you to open the same frame more than once.) There are four ways to reference the FrameExec variable:
• Use the CurFrame system variable name to reference the current frame.
Use this variable when the frame needs to send a user event to it. The following frame script example illustrates this concept:
CurFrame.SendUserEvent(eventname =
'LoadBalanceTable');
• Use the ParentFrame attribute to reference the parent of the current frame.
Because the ParentFrame attribute represents the ProcExec object for the parent frame, you must cast it as a FrameExec object in order to use it as a FrameExec reference. The following frame script example illustrates this concept:
on windowclose =
begin
FrameExec(CurFrame.ParentFrame).SendUserEvent
(eventname = 'GraphicClosed');
return;
end;
• Use the reference variable returned by the openframe statement that you used to open the frame.
In the following example, graphic_frame is a variable of type FrameExec:
graphic_frame.SendUserEvent
(eventname = 'UpdateTitle',
messagevarchar = video.title);
• Store a FrameExec reference obtained through any of the previously mentioned methods in a global variable so you can access it from other frames.