ListIconGadget autoscroll

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
rndrei
Enthusiast
Enthusiast
Posts: 176
Joined: Thu Dec 28, 2023 9:04 pm

ListIconGadget autoscroll

Post by rndrei »

Please add the automatic rewind function to the last position in the ListIcon Gadget!
Fred
Administrator
Administrator
Posts: 18344
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: ListIconGadget autoscroll

Post by Fred »

Could we have more info, especially a small code to show the issue ?
User avatar
rndrei
Enthusiast
Enthusiast
Posts: 176
Joined: Thu Dec 28, 2023 9:04 pm

Re: ListIconGadget autoscroll

Post by rndrei »

So that the pointer automatically stands at the last position and scrolls the window down

Code: Select all

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)
   AddGadgetItem(0, -1, "1")
   AddGadgetItem(0, -1, "2")
   AddGadgetItem(0, -1, "3")
   AddGadgetItem(0, -1, "4")
   AddGadgetItem(0, -1, "5")
   Repeat
     Event = WaitWindowEvent()
   Until Event = #PB_Event_CloseWindow
 EndIf
BarryG
Addict
Addict
Posts: 4214
Joined: Thu Apr 18, 2019 8:17 am

Re: ListIconGadget autoscroll

Post by BarryG »

It's up to the user to manually do that (see below). It shouldn't be automatic because items can be added to the end in the background while the user is looking at or working with top items for selection. Like when the debug output window is adding lots of items and you can't scroll to the top to see what was first until all the additions finish.

Code: Select all

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)
  AddGadgetItem(0, -1, "1")
  AddGadgetItem(0, -1, "2")
  AddGadgetItem(0, -1, "3")
  AddGadgetItem(0, -1, "4")
  AddGadgetItem(0, -1, "5")
  SetGadgetState(0, 4)
  Repeat
    Event = WaitWindowEvent()
  Until Event = #PB_Event_CloseWindow
EndIf
User avatar
rndrei
Enthusiast
Enthusiast
Posts: 176
Joined: Thu Dec 28, 2023 9:04 pm

Re: ListIconGadget autoscroll

Post by rndrei »

I figured it out, everything works!
Post Reply