07 July 2021, 12:57 | #1 |
Registered User
Join Date: Apr 2009
Location: N/A
Posts: 962
|
How to know if user really clicked an option in a LISTVIEW_KIND gadget?
The size of a LISTVIEW_KIND gadget can be more than the number of options this has. When clicking on a LISTVIEW_KIND area but not an option, the last option gets selected (highlighted).
In the screenshot above, when the mouse is clicked on the blank area of the LISTVIEW_KIND, the index of the last option is printed in the console in the background even though this option was not clicked. At the moment I listen for click events on the LISTVIEW_KIND gadget as follows: Code:
msg = (struct IntuiMessage *)GT_GetIMsg(window->UserPort); msgClass = msg->Class; if(msgClass == IDCMP_GADGETUP) { case MY_LIST: { unsigned long selected; GT_GetGadgetAttrs(gad_mylist, window, NULL, GTLV_Selected, &selected, TAG_END); printf("%lu\n", selected); } } Last edited by Sim085; 07 July 2021 at 13:46. |
14 July 2021, 16:45 | #2 |
Registered User
Join Date: Apr 2020
Location: Warwickshire
Posts: 17
|
I've noticed that issue on our stream https://dosamigans.com, but never done anything about it. I expect you could set the GACT_FOLLOWMOUSE flag for the gadget and peek the mouse coordinates to decide whether it's over an item.
|
14 July 2021, 18:36 | #3 |
Coder/webmaster/gamer
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,641
|
I could fix it for the next update of AmigaOS, if it has not been already. The desired behaviour in this case is for the gadget to intercept the click but ignore it, right?
|
15 July 2021, 23:32 | #4 | ||
Registered User
Join Date: Apr 2009
Location: N/A
Posts: 962
|
Quote:
Thank you, will try that out. Quote:
My C programming / experience is very basic, so would not know what is best. However, when I was writing the code I was expecting GTLV_Selected would return null when clicking on a non-option. |
||
16 July 2021, 03:34 | #5 |
Coder/webmaster/gamer
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,641
|
OK, fixed for BB1.
Last edited by Minuous; 16 July 2021 at 05:23. |
16 July 2021, 15:14 | #6 |
Registered User
Join Date: Apr 2020
Location: Warwickshire
Posts: 17
|
Presumably ~0, rather than null, otherwise you can't tell selected item 0 from clicked outside
|
16 July 2021, 15:28 | #7 |
Coder/webmaster/gamer
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,641
|
Yes, ~0.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
#LISTVIEW_KIND gadget and keyboard + mouse | peceha | Coders. Blitz Basic | 2 | 15 August 2018 11:26 |
DPaint tool buttons go blank when clicked on | okee | project.ClassicWB | 3 | 24 March 2018 03:12 |
Run WHDload as if I clicked on the icon | rsn8887 | support.Apps | 2 | 16 January 2016 20:08 |
Autostart for configs when double clicked | Quinnx | request.UAE Wishlist | 2 | 13 May 2013 05:44 |
Gadget/Layout.gadget V44 | ruliovega | support.Apps | 6 | 02 January 2006 11:50 |
|
|