Selecting items in ListIconGadget

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

Selecting items in ListIconGadget

Post by Angelo »

Something must be wrong with the following code! Because:
Neither the third item is selected (which I expected because of SetGadgetState(1,2)) nor do the cursor up/down keys show any effect.
But when I click an item inside the ListIconGadget, I can move up and down in the list with the cursor keys.
Here's the code:

Code: Select all

Procedure CloseWindowEvent()
   CloseWindow(EventWindow())
EndProcedure


OpenWindow(0, 0, 0, 300, 150, "ListIconGadget", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
ListIconGadget(1, 50, 20, 200, 120, "Comumn", 120)

BindEvent(#PB_Event_CloseWindow, @CloseWindowEvent())

For i = 0 To 10
   AddGadgetItem(1, -1, "line #" + Str(i))
Next i   

SetActiveGadget(1)
SetGadgetState(1, 2) ;select third item

CompilerIf #PB_Compiler_OS <> #PB_OS_Web
    Repeat
      Event = WaitWindowEvent()
    Until Event = #PB_Event_CloseWindow
CompilerEndIf
User avatar
Peter
Posts: 1093
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: Selecting items in ListIconGadget

Post by Peter »

Hello Angelo,

take a look at this thread: http://forums.spiderbasic.com/viewtopic ... 4325#p4325

Greetings ... Peter
Angelo
Posts: 15
Joined: Tue Jul 14, 2015 9:14 am

Re: Selecting items in ListIconGadget

Post by Angelo »

Thanks, Peter, for the link to the answer you gave a couple of days before (shame on me that I didn't search more accurately ...)

But I have another question:
In deed, I can select item 5 with the help of your workaround. But starting from that point, the cursor keys show no effect. So, I have to click on this item 5 first, and then I can scroll the item list with the cursor keys. Is there a possibility to enable "cursor action" without prior clicking of an item in the ListIconGadget?
Post Reply