Unexpected behavior of the ListIconGadget

Just starting out? Need help? Post your questions and find answers here.
Angelo
Posts: 15
Joined: Tue Jul 14, 2015 9:14 am

Unexpected behavior of the ListIconGadget

Post by Angelo »

I took the example from the SpiderBasic help and extended it a little bit by selecting the first row and by implementing an EventHandler for the gadget:

Code: Select all

Procedure ListHandler()   
   Debug "List event occurs"
EndProcedure   

If OpenWindow(0, 100, 100, 300, 100, "ListIcon Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
   ListIconGadget(0, 5, 5, 290, 90, "Name", 100, #PB_ListIcon_FullRowSelect | #PB_ListIcon_AlwaysShowSelection)
   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 PureBasic Road, BigTown, CodeCity")
 EndIf
 
SetActiveGadget(0) 
SetGadgetState(0, 0) 
BindGadgetEvent(0, @ListHandler())
The first strange thing is that the first row is not selected. So I clicked on it and then the debug message "list event occurs" showed up. By hitting the cursor down key I was able to select the second row, but - and this is the second strange thing - there is no debug message although an event took place, i. e. selecting the second row.