Reference for the Mosaic class Core::SystemEventHandler

Core::SystemEventHandler
Context
Enabled
Event
OnEvent

SEE ALSO

Using System Event Handler.

Creating a system event and implementing a TriggerEvent method.

The class Core::SystemEventHandler provides a convenient component able to react to system events. Such events are usually generated by the real device the GUI application is designed for. Every time the device notifies the GUI application about a particular event, the corresponding system event handlers are activated. Here for example, the device can report the current status of an engine every time this engine starts or stops. Thereupon the GUI application can react to such event and e.g. update the screen.

In Embedded Wizard every system event is represented by its own Core::SystemEvent instance. Usually you create and maintain such instances globally, e.g. within a device autoobject. Once a system event instance is available, you can connect a system event handler with it. For this purpose assign the system event instance to the property Event. Later at the runtime when the system event instance is triggered, all associated system event handlers will be notified causing each handler to send a signal to a slot method stored in its property OnEvent. In the slot method you are free to implement what to do in response to the event.

Please note, the delivery of events succeeds asynchronously however always accordingly to the order in which the events were triggered.

var object Context;

The variable 'Context' stores the optional object provided together with the system event. The variable is valid only while the system event is delivered.

property bool Enabled = true;

This property 'Enabled' determines whether the handler is active and willing to react to the system event. If this property is 'false' the handler ignores the events.

property Core::SystemEvent Event = null;

The property 'Event' stores the system event instance from which the handler desires to receive the events. The system event delivers the events to all associated handlers automatically.

property slot OnEvent = null;

The property 'OnEvent' can store a slot method which will receive a signal as soon as the corresponding system event is delivered. The affected system event is determined by the property Event.

The implementation of the slot method can react to the event. In particular it can access and evaluate the object stored in the variable Context - a kind of additional information you can pass together with the system event when the event is triggered (See Core::SystemEvent).