Reference for the Mosaic class Core::PropertyObserver



Using Property Observer.

The class Core::PropertyObserver provides a convenient component able to react to notifications when an associated property changes its value. The component provides a simple interface to register a slot method which will receive a signal when a property is notified as changed. The observed property is determined in Outlet. The slot method can be stored in the property OnEvent.

property bool Enabled = true;

The property 'Enabled' determines whether the handler is active and willing to react to notifications from the observed property. If this property is 'false' the handler ignores the notifications.

property slot OnEvent = null;

The property 'OnEvent' stores a slot method which should receive a signal as soon as the observed property specified in Outlet is notified.

property ^any Outlet = null;

The property 'Outlet' refers to the property to observe by this handler. As soon as the observed property is notified the handler will send a signal to the slot method specified in OnEvent.

method void Trigger();

The method Trigger() causes the property stored in Outlet to be notified. Accordingly all observers currently attached to this property will receive notifications. The invocation of this method corresponds to the Chora statement 'notifyobservers'. This method exists for convenience purposes only.