De-select Multi-ListViewGadget

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

De-select Multi-ListViewGadget

Post by WilliamL »

I'm confused. Below is the way I understand how the events work for the ListViewGadget(). I am assuming that I have to use EventType() before reading the GetGadgetItemState(,) and that would normally mean that I would look for a #PB_EventType_LeftClick then read the item state. That works fine for selecting a line but if I want to deselect a line it doesn't work as a #PB_EventType_LeftClick but as 768. If I substitute 768 for #PB_EventType_LeftClick I can select and de-select without problems. What is going on?

Code: Select all

OpenWindow(0, 100, 100, 300, 200, "ListView") 
ListViewGadget(0, 100, 50, 100, 100, #PB_ListView_MultiSelect) 
AddGadgetItem(0, -1, "Item 1") 
AddGadgetItem(0, -1, "Item 2") 
AddGadgetItem(0, -1, "Item 3") 
AddGadgetItem(0, -1, "Item 4") 

Repeat
    event=WaitWindowEvent()
    Select event
    Case #PB_Event_Gadget
        ;assume gadget is #0
        Debug "EventType()="+Str(EventType())
        Select EventType()
        Case #PB_EventType_Change ; works for selecting/deselecting line instead of #PB_EventType_LeftClick which only works with selecting
            Debug "Line clicked on = "+Str(GetGadgetState(0))
            For x=0 To 3
                Debug "  Item "+Str(x)+" = "+Str(GetGadgetItemState(0,x))
            Next
        EndSelect
    EndSelect
Until event = #PB_Event_CloseWindow
Last edited by WilliamL on Thu Oct 15, 2009 3:04 am, edited 3 times in total.
MacBook Pro-M1 (2021), Tahoe 26.1, PB 6.30b2
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Re: De-select Multi-ListViewGadget

Post by Rook Zimbabwe »

It is the way the program is set up... I use a framework but I use Windows... look at this and see if it works for you:

Code: Select all

PB COMPILER PROBS... wait a bit...
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
WilliamL
Addict
Addict
Posts: 1255
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Re: De-select Multi-ListViewGadget

Post by WilliamL »

I suppose my first question is what 768? Is that the value for an existing constant and which one is it? If I knew what the event was (768) then I could decide if it will cause unforeseen problems. My need now is just to respond to select and deselect by the mouse and this works fine.

[later]
Well, it seems that #PB_EventType_Change=768. Seems like that should work fine for my needs.

It does appear that the ListViewGadget must be #PB_ListView_MultiSelect for the #PB_EventType_Change to work. If the ListViewGadget() is not flagged as #PB_ListView_MultiSelect then the #PB_EventType_Change only appears with a left double-click. If the gadget is not a MultiSelect, only left double-click will give a usable event if that line is already selected.
MacBook Pro-M1 (2021), Tahoe 26.1, PB 6.30b2
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Re: De-select Multi-ListViewGadget

Post by Rook Zimbabwe »

William... this bit of code has been kicking my butt! I apologize...

I do reccomend yuo compile a small example program and get a few people to test it on their Macs as well... different OS versions and etc. MAY have different ##s

There is a way you can GET thatnumber to make sure it is assigned correctly... But you know what that is. :mrgreen:
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
Post Reply