Link Search Menu Expand Document

Object.PostEvent Method

Explanation Send an event to the object.

This method allows the CRS program to raise an event at any time.
Events are passed to the corresponding event handler via the event queue.See Events and Event Handlers for more information.

When sending a user-defined event, use the event number of the Reason property after the code number indicated by UserEvent ( such as UserEvent + 1 ) so that it does not overlap with the system-defined event number.

When sending a system-defined event, you can specify the event name as is for ev.

The event can be forwarded to the parent object by calling the PostEvent method in the event handler with no arguments.
Call format obj.PostEvent( [ ev ] )
Return value None
Arguments Event ev Event object for user-defined events to send
Or system-defined event name
If omitted, the event is forwarded to the parent object as it is.
Exception None
Example of use
/* User-defined event */
PostEvent(new Event(UserEvent + 1, "AppEvent1"));
 
/* System-defined event */
PostEvent(Touch);
 
Function OnAppEvent1(e) {
    print("AppEvent1\n");
}
Function OnTouch(e) {
    print("Touch\n");
}
 
Related item Event class