@broadblues
Quote:
Not sure if it all that obvious, but while i got it, still will share some info as maybe someday someone else will search amigans.net for that info.
So, i was told today by Dan that we do have actually 2 methods of using ICA_*. After some digging and testing that indeed few ways : One is just when you create a map, like:
struct TagItem button_to_string_map[] = {
{GA_Selected, MYTAG_UPDATE},
{MYTAG_UPDATE, (ULONG)"Button Fucked !"},
{TAG_END, 0}
};
and then:
/* Create String gadget */
Object *string_gadget = IIntuition->NewObject(StringClass, NULL,
GA_ID, GID_STRING,
GA_RelVerify, TRUE,
STRINGA_TextVal, "Initial Text",
STRINGA_MaxChars, 256,
TAG_END);
if (!string_gadget) {
IDOS->Printf("Failed to create String gadget.\n");
goto cleanup;
}
/* Create Button gadget with ICA_TARGET and ICA_MAP */
Object *button_gadget = IIntuition->NewObject(ButtonClass, NULL,
GA_ID, GID_BUTTON,
GA_RelVerify, TRUE,
GA_Text, "Click Me",
ICA_TARGET, string_gadget, /* Send OM_UPDATE to String gadget */
ICA_MAP, button_to_string_map, /* Map GA_Selected to MYTAG_UPDATE */
TAG_END);
This way winObj have no needs to have any IDCMP_IDCMPUPDATE/WINDOW_IDCMPHook/etc flags, and it works as OM_UPDATE.
Then, another way is like you say : creating an IDCMPHook, via adding to main window object like:
WINDOW_IDCMPHook,&idcmphook,
WINDOW_IDCMPHookBits,IDCMP_IDCMPUPDATE,
And then while our main loop is still reaction based with != WMHI_LASTMSG, we in the hook do:
switch (imsg->Class)
{
case IDCMP_IDCMPUPDATE:
switch (GetTagData (GA_ID,0,imsg->IAddress))
{
case GID_blablba:
.......
break;
}
break;
}
Surely first way give not much control , just an information, but maybe that also enough ?