Program notification when String Gadget goes Active

9 posts / 0 new
Last post
tbreeden
tbreeden's picture
Offline
Last seen: 6 years 2 months ago
Joined: 2010-12-09 03:10
Program notification when String Gadget goes Active

Using a Reaction class String gadget in a Reaction class window, I'd like the
program to be able to tell when the gadget goes active.

Does anyone know how to get that activation information?

Reaction HandleInput doesn't have a "WMHIGadgetDown" and WMHIActive tells
you that the Window is active, but not which gadget.

The WINDOW_IDCMPHook hook never seems to get called with an
IDCMPGadgetDown, no matter what is in WINDOW_IDCMPHookBits.

It looks like maybe you could use IDCMPIDCMPUpdate, but I don't know how to
get the string gadget to do an OM_Notify or OM_Update upon activation.
Maybe it is necessary to create a new subclass that just sends all incoming
methods on to its String class parent except in OM_Activate it also generates
a message to the Window port?

Have I missed something simple?

Thanks,

Tom

salass00
salass00's picture
Offline
Last seen: 1 month 3 days ago
Joined: 2011-02-03 11:27
@tbreeden Have you set

@tbreeden

Have you set GA_Immediate to TRUE when creating the string gadget? Also make sure that IDCMP_GADGETDOWN is enabled in WA_IDCMP.

tbreeden
tbreeden's picture
Offline
Last seen: 6 years 2 months ago
Joined: 2010-12-09 03:10
Have you set GA_Immediate to

Have you set GA_Immediate to TRUE when creating the string gadget? Also make sure that IDCMP_GADGETDOWN is enabled in WA_IDCMP.

Tried those. GA_Immediate does not seem to do anything for the Reaction string
gadget, with or without IDCMP_GADGETDOWN in WA_IDCMP.

I wonder if it is possible/wise to try to mix non-Reaction Boopsi gadgets
in the same window with Reaction gadgets?

Tom

salass00
salass00's picture
Offline
Last seen: 1 month 3 days ago
Joined: 2011-02-03 11:27
@trixie If you need to use a

@trixie

If you need to use a gadget that doesn't support GM_DOMAIN method inside a layout you can always specify the minimum and maximum width and height for it using CHILD_#? tags.

salass00
salass00's picture
Offline
Last seen: 1 month 3 days ago
Joined: 2011-02-03 11:27
Tried those. GA_Immediate


Tried those. GA_Immediate does not seem to do anything for the Reaction string
gadget, with or without IDCMP_GADGETDOWN in WA_IDCMP.

Are you using an IDCMP hook function? Otherwise you won't be able to intercept any IDCMP_GADGETDOWN messages since the WM_HANDLEINPUT method doesn't allow checking for those yet.

tbreeden
tbreeden's picture
Offline
Last seen: 6 years 2 months ago
Joined: 2010-12-09 03:10
Are you using an IDCMP hook

Are you using an IDCMP hook function? Otherwise you won't be able to intercept any IDCMP_GADGETDOWN messages since the WM_HANDLEINPUT method doesn't allow checking for those yet.

Yep. I do see IDCMP_GADGETUP in the hook function, but never IDCMP_GADGETDOWN.
Maybe the Reaction Window/Layout is eating the gadget-down when generating the
GM_GOACTIVE.

tbreeden
tbreeden's picture
Offline
Last seen: 6 years 2 months ago
Joined: 2010-12-09 03:10
OK. I got salass00's sample

OK. I got salass00's sample code (which seems to have disappeared from the comments) and replicated it. Then I did get the IDCMP_GADGETDOWN messages in the Hook procedure.

Traced the problem in my code to a typo that nullified the GA_Immediate setting for the String gadget.

However, there is still a problem, since the IntuiMessage .IAddress field in the received message at the Hook contains the address of the Reaction window's root Layout gadget, and not the String gadget itself. This behaviour is documented for IDCMP_GADGETUP in the autodocs (in layout_gc.doc) and must be similar for IDCMP_GADGETDOWN.

For GadgetUp, special provisions are made in the Reaction Layout gadget to determine the actual gadget that was activated:

However, layout.gadget sends a notification for all
gadgetups, containing the tags GA_ID, LAYOUT_RelVerify and
LAYOUT_RelCode, containing, respectively, the ID, TRUE, and the
IntuiMessage.Code value it returned.

And the notification will appear in the hook as in IDCMP_IDCMPUPDATE message.

It does not seem to do this for GADGETDOWN's, and I can't figure a way
to determine which Reaction window gadget was actually activated.

Tom

tbreeden
tbreeden's picture
Offline
Last seen: 6 years 2 months ago
Joined: 2010-12-09 03:10
test This discussion seems

test

This discussion seems to have been truncated? Two comments lopped off the end.

Log in or register to post comments