Page 1 of 2
When selecting a list item, ensure it is visible
Posted: Thu Feb 18, 2016 4:08 pm
by SparrowhawkMMU
Hi,
Currently, if you use SetGadgetState() to select an item in a list box that is not currently visible (ie further up or down in the list so not in the visible view of the list gadget), it is not scrolled into view
Could this be changed so that even if the row is not visible, it is made visible (brought into focus) when selected programatically
Thanks
Re: When selecting a list item, ensure it is visible
Posted: Thu Feb 18, 2016 5:46 pm
by Fred
Could you post a small snippet ?
Re: When selecting a list item, ensure it is visible
Posted: Thu Feb 18, 2016 6:50 pm
by Peter
Fred wrote:Could you post a small snippet ?
http://forums.spiderbasic.com/viewtopic ... 1251#p1251
(also for ListViewGadget())
Greetings ... Peter
Re: When selecting a list item, ensure it is visible
Posted: Fri Feb 19, 2016 1:13 pm
by SparrowhawkMMU
What he said
Seriously though, if you need more from me, let me know.
Re: When selecting a list item, ensure it is visible
Posted: Thu Apr 26, 2018 1:40 am
by Paul
Any progress on this request?
It's really annoying using AddGadgetItem() on a big list and the ListIconGadget resets itself to the beginning every time.
Re: When selecting a list item, ensure it is visible
Posted: Thu Apr 26, 2018 6:44 am
by Peter
obviously my code I'm referring to above has been deleted.
For this reason here once again:
Code: Select all
If OpenWindow(0, 0, 0, 270, 140, "ListViewGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ListViewGadget(0, 10, 10, 250, 120)
For a = 1 To 12
AddGadgetItem (0, -1, "Item " + Str(a) + " of the Listview")
Next
SetGadgetState(0, 10)
EndIf
Re: When selecting a list item, ensure it is visible
Posted: Thu Apr 26, 2018 5:45 pm
by Paul
Hi Peter,
Your code demonstrated the problem. The item is highlighted but is not in view. You have to scroll down to see the highlighted item.
Re: When selecting a list item, ensure it is visible
Posted: Thu Apr 26, 2018 6:16 pm
by Peter
Paul wrote:Your code demonstrated the problem.
Yeah, that was the plan.
Fred wanted to have a code snippet and now he has it (again).
Re: When selecting a list item, ensure it is visible
Posted: Thu Aug 30, 2018 2:46 pm
by Dirk Geppert
Is there already a solution? Maybe a workaround?
Strangely enough, it works within a larger web project. Unfortunately, I can't reproduce what's the reason it works.

Re: When selecting a list item, ensure it is visible
Posted: Thu Aug 30, 2018 3:57 pm
by Peter
Dirk Geppert wrote:Maybe a workaround?
Code: Select all
Procedure ScrollIntoView(Gadget)
! if (($(spider_GadgetID(v_gadget).div).find(".dgrid-selected")).length > 0) {
! spider_GadgetID(v_gadget).gadget.scrollTo({x:0,y:$(spider_GadgetID(v_gadget).div).find(".dgrid-selected").position().top})
! }
EndProcedure
If OpenWindow(0, 0, 0, 270, 140, "ListViewGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ListViewGadget(0, 10, 10, 250, 120)
For a = 1 To 12
AddGadgetItem (0, -1, "Item " + Str(a) + " of the Listview")
Next
SetGadgetState(0, 10)
ScrollIntoView(0)
EndIf