Receiving events from gadgets: ICA_TARGET model objects or ICTARGET_IDCMP, and how ?
Some month ago, I suggested receiving button and sliders OM_NOTIFY events to a modelclass boopsi object, that stands for my app, would be a correct approach... This works nice, but there is something annoying: receiving OM_NOTIFY is done on the context of the sending Gadget, which means a special context, not on the main process or anywhat, and I'm supposed to process lots of things. So I figured out ICA_TARGET,ICTARGET_IDCMP seems to be a better approach, as I guess messages are delayed, and hopefully catched in the main loop, at the lowest recursion possible, which is prefect. But then my loop is managed with DoMethod(app->window_obj, WM_HANDLEINPUT,..) and WMHI_XXXX enums for events, not the intuition IDCMP level. And there are WMHI_XXX enums for lots of messages... but nothing that mirrors IDCMPUPDATE message !
On the devCD2.1, Early boopsi exemples from 1991 just do WaitPort( w->UserPort ) then switch ( imsg->Class ) to IDCMPUPDATE, then retrieve the full gadget notify taglist (what I need) in IDCMPUPDATE (Reference/DevCon/Milan_1991/Devcon91.1/Libraries/Intuition/other_examples/boopsi/demo5.c)
So well: Is there a way to get IDCMPUPDATE full OM_NOTIFY messages with WMHI_SOMETHING , or is there a way to both handle message with GetMsg( w->UserPort ) and DoMethod(app->window_obj, WM_HANDLEINPUT,..) ? Or some methods I don't know ?
Sorry for having absent for a while - I'm currently busy with real life outside of amiga world.
OM_notify directly to another object is done in context of intuition input task. if you route to ICTARGET_IDCMP the handling is done by the program owning the window port (task/process creating the window)
In 3.3 it will be possible to attach any number of function as targets of beacons (a new kine of object event eg buttonclicked). These functions will be executed on the program task.
As for getting IDCMP updates via WMHI_xxx kind of thing then indeed there is not a direct way, but window.class allows you to set up a hook that will be called instead.
Online Status
Brrr ... By definition using GetMsg() at Window->UserPort level is impossible because messages can be read only once.
ICA_TARGET,ICTARGET_IDCMP looks totally impossible to get, Apparently I'll have to manage my own message stack to delay OM_NOTIFY from a target modelclass to main loop.
... some WMHI_IDCMPUPDATE is clearly missing.
Edit: At the end I found out a button gadget would set OM_NOTIFY with GA_Selected when mouse click down and move, orduring a slider movement, but will send nothing at the "gadget up." when action in finished on the gadget. That is precisely what is returned by WHMI_GAGDGETUP ,with just the GA_ID ! So what I do finally is gathering the OM_NOTIFY received by a modelclass object received as a ICA_TARGET for everyone, and the WHMI_GAGDGETUP , in a message stack that is delayed to the next main loop turn. That way I have all the messages needed, treated by the right process with no recursion , with the GA_ID of the gadget and all movements and gadgetup.