GetGadgetState() error on the ListIconGadget header.

Just starting out? Need help? Post your questions and find answers here.
falsam
Posts: 288
Joined: Mon May 05, 2014 9:49 pm
Location: France
Contact:

GetGadgetState() error on the ListIconGadget header.

Post by falsam »

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
■ Click on the header, GetGadgetState() returns -1.

■ 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.

➽ Windows 11 - jdk-11.0.2 - SB 3.10 - Android 16
https://falsam.com

Sorry for my poor english