Reference for the Mosaic class Core::SystemEvent

Core::SystemEvent
Trigger()

SEE ALSO

Creating a system event and implementing a TriggerEvent method.

Using System Event Handler.

The class Core::SystemEvent provides a convenient component intended to represent a source of an individual system event. Such events are usually generated by the real device the GUI application is designed for. Here for example, the device can report the current status of an engine every time this engine starts or stops.

Sophisticated mechanisms behind Core::SystemEvent take care of the delivery of all events to associated handler components (see Core::SystemEventHandler). The delivery succeeds asynchronously however always accordingly to the order in which the events were triggered.

To trigger an event simply call the method Trigger(). Each time you trigger an event, you can optionally provide a context object to be dispatched together with the event. In this manner flexible application cases are possible.

Usually you create and maintain system event instances globally, e.g. within a device autoobject. Once a system event instance is available, you can connect one or more system event handlers with it.

method void Trigger
(
arg object aContext,
arg bool aWithPriority
);

The method Trigger() enqueues this event for delivery. The delivery occurs asynchronously in the order in which the events are triggered. If the parameter aWithPriority is false, the new event will be arranged at the end of a common system event queue. If the parameter is true, the event is enqueued in front of all waiting events causing it to be delivered early.

When the event is delivered all associated Core::SystemEventHandler components are notified to handle the event. Here the system event handler can access and evaluate the optional context data passed in the parameter aContext.