Add a notification event handler to an object
Source position: mui.pas line 685
const MUIM_Notify = $8042c9cb; |
DoMethod(obj, MUIM_Notify, [TrigAttr: LongWord, TrigVal: LongWord, DestObj: APTR, FollowParams: LongWord, ... );
Add a notification event handler to an object. Notification is essential for every MUI application.
A notification statement consists of a source object, an attribute/value pair, a destination object and a notification method. The attribute/value pair belongs to the source object and determines when the notification method will be executed on the destination object.
Whenever the source object gets the given attribute set to the given value (this can happen because of the user pressing some gadgets or because of your program explicitly setting the attribute with SetAttrs()), the destination object will execute the notification method.
With some special values, you can trigger the notification every time the attribute is changing. In this case, you can include the triggering attributes value within the notification method. See below.
One big problem with notification are endless loops. Imagine you have a prop gadget and want to show its state with a gauge object. You connect MUIA_Prop_First with MUIA_Gauge_Max and everything is fine, the gauge gets updated when the user drags around the gadget. On the other hand, if your program sets the gauge to a new value, you might want your prop gadget to immediately show this change and connect MUIA_Gauge_Max width MUIA_Prop_First. Voila, a perfect endless loop.
To avoid these conditions, MUI always checks new attribute values against the current state and cancels notification when both values are equal. Thus, setting MUIA_Prop_First to 42 if the prop gadgets first position is already 42 won't trigger any notification event.