English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 07 July 2021, 12:57   #1
Sim085
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);

   }

}
Is there a way how I can listen for a mouse click only when an option is clicked?
Attached Thumbnails
Click image for larger version

Name:	list.png
Views:	310
Size:	9.2 KB
ID:	72484  

Last edited by Sim085; 07 July 2021 at 13:46.
Sim085 is offline  
Old 14 July 2021, 16:45   #2
leeg
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.
leeg is offline  
Old 14 July 2021, 18:36   #3
Minuous
Coder/webmaster/gamer
 
Minuous's Avatar
 
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,630
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?
Minuous is offline  
Old 15 July 2021, 23:32   #4
Sim085
Registered User
 
Join Date: Apr 2009
Location: N/A
Posts: 962
Quote:
Originally Posted by leeg View Post
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.

Thank you, will try that out.



Quote:
Originally Posted by Minuous View Post
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?

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.
Sim085 is offline  
Old 16 July 2021, 03:34   #5
Minuous
Coder/webmaster/gamer
 
Minuous's Avatar
 
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,630
OK, fixed for BB1.

Last edited by Minuous; 16 July 2021 at 05:23.
Minuous is offline  
Old 16 July 2021, 15:14   #6
leeg
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
leeg is offline  
Old 16 July 2021, 15:28   #7
Minuous
Coder/webmaster/gamer
 
Minuous's Avatar
 
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,630
Yes, ~0.
Minuous is offline  
 


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 21:06.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.07803 seconds with 14 queries