ListIconGadget - #PB_ListIcon_CheckBoxes - any event?

Mac OSX specific forum
WilliamL
Addict
Addict
Posts: 1255
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

ListIconGadget - #PB_ListIcon_CheckBoxes - any event?

Post by WilliamL »

Does pb generate an event when the check box is clicked? I'd like to know when I checked a box so I can react to it. I only seem to get an event if I check on the line that has the check box.

Code: Select all

If OpenWindow(0, 0, 0, 400,400, "ListIconView...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)

       ListIconGadget(1, 10, 10,380,380,"First column:",200,#PB_ListIcon_CheckBoxes | #PB_ListIcon_GridLines) 
       AddGadgetColumn(1,1,"Column two",100)
       For a= 1 To 4 : AddGadgetItem(1, -1, "Line "+Chr(10)+Str(a)) : Next
              
     Repeat
       Event = WaitWindowEvent()
       Select Event
         Case #PB_Event_Gadget
           Select EventGadget()
             Case 1 
               Select EventType()
                 Case #PB_EventType_LeftClick
                     AddGadgetItem(1, -1, "left click on line "+Str(GetGadgetState(1)+1))
               EndSelect
           EndSelect
       EndSelect
     Until Event = #PB_Event_CloseWindow
EndIf
If you run this you will get a response if you click on column one or two but nothing if you click the box.
MacBook Pro-M1 (2021), Tahoe 26.1, PB 6.30b2
User avatar
michel51
Enthusiast
Enthusiast
Posts: 290
Joined: Mon Nov 21, 2005 10:21 pm
Location: Germany

Re: ListIconGadget - #PB_ListIcon_CheckBoxes - any event?

Post by michel51 »

WilliamL wrote:Does pb generate an event when the check box is clicked? I'd like to know when I checked a box so I can react to it. I only seem to get an event if I check on the line that has the check box.
I think there is no event.
Look into the help to "getgadgetitemstate()".
You have to detect the checkbox by yourself if you have used the > #PB_ListIcon_CheckBoxes < Flag.
michel51

Mac OS X Snow Leopard (10.6.8 ) Intel
PureBasic V 5.21(x64), V 5.22beta
WilliamL
Addict
Addict
Posts: 1255
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Post by WilliamL »

Thanks for the reply. It's nice to get some feedback incase I overlooked something. (I keep forgetting that there is a pdf help manual to look into also.)

I decided to set the checkbox to 'checked' when the line is clicked. That way I can do the other procedures and have the check. That meets my needs in this situation. Same result, just not as intuitive.
MacBook Pro-M1 (2021), Tahoe 26.1, PB 6.30b2
Post Reply