Language Reference Guide : System Classes : GhostExec Class : MessageObject Attribute
 
Share this page          
MessageObject Attribute
Data Type: Object
4GL Access: R
When a frame receives a user event, this attribute contains the object assigned to the messageobject parameter of the SendUserEvent call.
Use this attribute in a UserEvent block to access the object passed to the frame with the messageobject parameter of the SendUserEvent call for that user event. To provide flexibility, the messageobject parameter and this attribute are of the generic Object type. This is so you can pass any type of object between frames with the SendUserEvent method.
When you access this attribute, you must cast it to the correct class of the object that is expected. For example, if you want one frame to send a UserEvent to another frame with a BitmapObject, you could use the following 4GL code:
/* ... in declaration ... */
bitmapobjptr = BitmapObject;
testframeptr = FrameExec;
...
testframeptr = OpenFrame testframe(...);
testframeptr.SendUserEvent(eventname = 'testevent',
          messageobject = bitmapobjptr);
The object passed in the messageobject parameter is assigned to the variable, mybitmapobjptr, in the receiving frame. You could then process the event in testframe with this 4GL code:
/* ...in declaration... */
mybitmapobjptr = BitmapObject;
    ...
on userevent 'testevent' =
begin
    if curframe.MessageObject is not null then
        mybitmapobjptr =
        BitmapObject(Curframe.MessageObject);
        message 'Got it...';
    endif;
end
For information on casting, see the Programming Guide.
This attribute is null if the SendUserEvent call that triggered the event did not send an object. This attribute is also null for all events other than UserEvent.