ListIconGadget() Scrolling

Windows specific forum
RichardL
Enthusiast
Enthusiast
Posts: 532
Joined: Sat Sep 11, 2004 11:54 am
Location: UK

ListIconGadget() Scrolling

Post by RichardL »

When I add strings to a ListViewgadget() and must ensure the last item is visible I use this code:


AddGadgetItem(3,-1,"Rx: "+String$)
SendMessage_(GadgetID(3), #LB_SETTOPINDEX, CountGadgetItems(3)-1, 0)


It does not work with a ListIconGadget(), probaly because the constant #LB_SETTOPINDEX is not right.

Please, can anyone help with the proper value?

Thanks
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: ListIconGadget() Scrolling

Post by PB »

Just do this to select and make visible the last item:

Code: Select all

SetGadgetState(#gad,CountGadgetItems(#gad)-1)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

To ensure an item is visible :

ListViewGadget SendMessage_(GadgetID(#ListView), #LB_SETTOPINDEX, Item, 0)

ListIconGadget SendMessage_(GadgetID(#ListIcon), #LVM_ENSUREVISIBLE, Item, 0)
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Post Reply