Errorevent Parameter
The errorevent parameter specifies a user event that is returned to the sending frame by the system if the current user event cannot be delivered. The following examples demonstrate how to use this parameter.
The following code would be in the sending frame:
declare
response = Event;
enddeclare
begin
targetframe.SendUserEvent (
eventname = 'originalevent',
errorevent = 'replyevent');
response = CurFrame.WaitFor (
eventname = 'replyevent');
if response.MessageErrorCode = 0 then
/*
** The target frame received
** and replied.
*/
...
else
/*
** The target frame never got the
** event.
*/
...
endif;
end;
In the target frame:
on userevent 'originalevent' =
{
/* Acknowledge that the event is received */
sendingframe.SendUserEvent
(eventname = 'replyevent');
/* Now process the event */
...
}
Important! The target frame must reply with the replyevent event. Otherwise, the WaitFor method will not return, providing the event was delivered.
The following examples show another way of using the errorevent parameter without using the WaitFor method.
The following code would be in the sending frame:
begin
targetframe.SendUserEvent
(eventname = 'originalevent',
errorevent = 'errorevent');
end;
The following code would be in the target frame:
on userevent 'originalevent' =
{
/* Process the event */
...
}
on userevent 'errorevent' =
{
/* Error handling */
...
}
For more information about MessageErrorCode, see the Language Reference Guide.