I'm updating an existing BOOPSI gadget to support the OM_NOTIFY method on the GA_Selected attribute. The idea is that the gadget (a checkbox kind) can act as a "master" gadget that sets the value of its subordinate gadgets. Thus, when the master's GA_Selected is set to TRUE/FALSE, the subordinate gadgets will receive an OM_NOTIFY to set their value to that of the master. For this to work, the master checkbox adds the subordinate checkboxes to its broadcast list via OM_ADDMEMBER.
In the "rkrmmodelclass.c" example in the Amiga Dev Wiki, the actual execution of the OM_NOTIFY method is delegated to the superclass (model.class), which informs the gadgets on the rkrmmodel.class's broadcast list.
OK, that's the model class kind. But what I'm not sure about is how gadgetclass subclasses are supposed to act. Should the OM_NOTIFY be handled by my checkbox gadget, or should I pass it on to gadgetclass by calling IDoSuperMethod()?
Gadgets don't have a distribution list. OM_ADDMEMBER has no function for gadgets, unless you implement it. A BOOPSI class only has a built-in node, but not a built-in list. So you can add a BOOPSI object to a list by calling its OM_ADDTAIL method. But if you want a list, you have to add a struct List to your instance data and implement the OM_ADDMEMBER method, which calls the member's OM_ADDTAIL method with a pointer to your list. But as you can imagine, adding an object to a random list does not have any substance.
To notify another object about changes, you call the OM_NOTIFY method of your super class. The super class then calls the OM_UPDATE method of its ICA_TARGET with the data you provided.
If you want to forward the notification to multiple objects, you have to make a modelclass object, add all the targets to the model using OM_ADDMEMBER and then set the ICA_TARGET of your super class to the model.
Find attached an example with checkboxes.
File attachments:
@thomas
Thank you Thomas, as helpful and informative as always! The wiki documentation on OM_ADDMEMBER is a bit hazy. For example, in one place it says
and later in the text
which suggests that the OM_ADDMEMBER is a general method applicable to all BOOPSI classes. It didn't occur to me that gadgetclass doesn't implement a "personal list" to add objects to.
AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2