12. Inter-Frame Communication Techniques : Communicating Between OpenROAD Frames : How You Can Communicate Between Frames Using User Events : How You Can Access the SendUserEvent Parameters
 
Share this page                  
How You Can Access the SendUserEvent Parameters
The SendUserEvent method has four message parameters, messageobject, messageinteger, messagefloat, and messagevarchar that you can use to pass values to the receiving frame. For information about these parameters, see SendUserEvent Method (see SendUserEvent Method).
If the SendUserEvent call activates a userevent event block in the receiving frame, OpenROAD stores these values in four corresponding FrameExec attributes, MessageObject, MessageInteger, MessageFloat, and MessageVarchar, that are accessible only in the event block. To access this data, use the CurFrame system variable to reference the current FrameExec.
In the following sample from a frame script, the UpdateTitle event block sets the window title to the value of the MessageVarchar attribute that is passed to the frame by the messagevarchar parameter of the SendUserEvent method:
on userevent 'UpdateTitle' =
begin
    CurFrame.WindowTitle =
    CurFrame.MessageVarchar;
end;
Because the MessageObject attribute stores an object of the generic Object class, you must cast the object to the appropriate system or user class in order to work with it in your user event block. (Casting is described in How You Can Work with Attributes (see How You Can Work with Attributes).)
In the following example, the MessageObject attribute contains a bitmap, so it is cast to the BitmapObject system class:
on userevent 'UpdateGraphic' =
begin
    vid_graphic_bitmap =
        BitmapObject(CurFrame.MessageObject);
    CurFrame.Flush();
    CurFrame.IsAutoSized = TRUE;
    CurFrame.WindowVisibility = WV_VISIBLE;
    CurFrame.BringToFront();
end;
In the next example, the MessageObject attribute contains an object of type video_row. The UpdateEntry event block casts the MessageObject to the video_row user class.
on userevent 'UpdateEntry' =
begin
    video = VIDEO_ROW(CurFrame.MessageObject);
Note:  If the SendUserEvent call completes a WaitFor method call, the message parameters are stored in the Event object returned by the WaitFor call. The Event object has five attributes. One attribute holds the name of the event and each of the other four holds one message parameter. You can access the parameter values in the Event object attributes in the event block that contains the WaitFor call.