ESC, ENTER or HELP key used to enter text in Reaction string gadget

This forum is for general developer support questions.
Post Reply
djg
Posts: 30
Joined: Sat Jan 26, 2013 5:00 pm

ESC, ENTER or HELP key used to enter text in Reaction string gadget

Post by djg »

Hi,

I finally decided to try programming using ReAction, it always looked so comlicated to me, and still does.
But I like the automatic layout and the look of it, so I will try some more.

My question is: how do I find out what caused a string gadget gadget up message (ESC key or ENTER key or HELP key).
Also I would like to know if any other keys were held down such as CTRL, ALT and SHIFT buttons.

I tried several things modifying the stringexample.c file in the SDK, but could not get it to work.
User avatar
thomasrapp
Posts: 310
Joined: Sat Jun 18, 2011 11:22 pm

Re: ESC, ENTER or HELP key used to enter text in Reaction string gadget

Post by thomasrapp »

I cannot tell exactly, I would have to test it myself.

In a pure Intuition environment you would receive a IDCMP_GADGETUP message and should see the key which caused it in IntuiMessage->Code and the qualifiers in IntuiMessage->Qualifier.

In ReAction all this is hidden inside window.class. You should get the code in the result from GM_HANDLEINPUT. I'm not sure how you can get the qualifier. Maybe there is a window.class attribute you can read.
djg
Posts: 30
Joined: Sat Jan 26, 2013 5:00 pm

Re: ESC, ENTER or HELP key used to enter text in Reaction string gadget

Post by djg »

I cannot tell exactly, I would have to test it myself.

In a pure Intuition environment you would receive a IDCMP_GADGETUP message and should see the key which caused it in IntuiMessage->Code and the qualifiers in IntuiMessage->Qualifier.
Yes, that's what I have been doing so far.
In ReAction all this is hidden inside window.class. You should get the code in the result from GM_HANDLEINPUT. I'm not sure how you can get the qualifier. Maybe there is a window.class attribute you can read.
I can't find a suitable attribute.
There is even another way to enter text, and that using the TAB key. I can test for that in the result of IDoMethod(obj, WM_HANDLEINPUT, &code). (The obj argument is the layout gadget that the string gadget is a child of).
xenic
Posts: 1185
Joined: Sun Jun 19, 2011 12:06 am

Re: ESC, ENTER or HELP key used to enter text in Reaction string gadget

Post by xenic »

djg wrote: Wed Jan 19, 2022 7:47 pm
Also I would like to know if any other keys were held down such as CTRL, ALT and SHIFT buttons.
I don't know if it will do what you want but you could search for the " peekqualifier() " function in the SDK autodocs. The "devices/inputevent.h" file lists the qualifier definitions.
AmigaOne X1000 with 2GB memory - OS4.1 FE
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 530
Joined: Sat Jun 18, 2011 3:12 pm
Location: Finland
Contact:

Re: ESC, ENTER or HELP key used to enter text in Reaction string gadget

Post by salass00 »

djg wrote: Thu Jan 20, 2022 10:50 pm
In ReAction all this is hidden inside window.class. You should get the code in the result from GM_HANDLEINPUT. I'm not sure how you can get the qualifier. Maybe there is a window.class attribute you can read.
I can't find a suitable attribute.
Then you can't have looked very hard. The attribute you want is called WINDOW_Qualifier.
WINDOW_Qualifier (uint16)
Current qualifiers from the IntuiMessage.Qualifier field.
Useful for obtaining the qualifiers after WM_HANDLEINPUT
has returned.

Applicability is (OM_GET)
djg
Posts: 30
Joined: Sat Jan 26, 2013 5:00 pm

Re: ESC, ENTER or HELP key used to enter text in Reaction string gadget

Post by djg »

Thank you both.

I just got PeekQualifier() to work when I read about WINDOW_Qualifier. I can't believe I missed that. Must be my aging eyes.
User avatar
thomasrapp
Posts: 310
Joined: Sat Jun 18, 2011 11:22 pm

Re: ESC, ENTER or HELP key used to enter text in Reaction string gadget

Post by thomasrapp »

PeekQualifier() does not necessarily give you the qualifier which was active when the string gadget was left. The IDCMP message could be delayed for whatever reason and the user could have released the qualifier key already or even pressed another one. Therefore WINDOW_Qualifier is the way to go.
djg
Posts: 30
Joined: Sat Jan 26, 2013 5:00 pm

Re: ESC, ENTER or HELP key used to enter text in Reaction string gadget

Post by djg »

While that makes sense to me, I would like to add that here I don't get the qualifiers at WMHI_GADGETUP, but I do at WMHI_RAWKEY. So I would have to remember them until the WMHI_GADGETUP message. An IDCMP_GADGETUP message simply supplies them immediately and without any room for error.
Post Reply