Code: Select all
Procedure foo()
Debug "item " + GetGadgetState(0)
EndProcedure
If OpenWindow(0, 100, 100, 300, 150, "ListIcon Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ListIconGadget(0, 5, 5, 290, 90, "Name", 100)
AddGadgetColumn(0, 1, "Address", 250)
AddGadgetItem(0, -1, "Harry Rannit"+Chr(10)+"12 Parliament Way, Battle Street, By the Bay")
AddGadgetItem(0, -1, "Ginger Brokeit"+Chr(10)+"130 SpiderBasic Road, BigTown, CodeCity")
BindGadgetEvent(0, @foo(), #PB_EventType_LeftClick)
EndIf
■ Now click on the first or second item in ListIconGadget(). The values returned by GetGadgetState() are correct.
■ Click on the header of ListIconGadget. GetGadgetState() returns the value of the last selected item instead of -1.