When using a WebListBoxCellRenderer to add multi-line data into a WebListBox, the WebListBox Class’ built-in ScrollTo method doesn’t scroll to the passed row.
It seems to be using the default row height and scrolling to (Default Row Height) * # of rows.
What’s the correct way to scroll to the requested row when the row height varies from row to row?
No experience, sorry.
From what I understand, Xojo Web uses the row height to do some internal calculations, changing the height outside of what is offered ‘works’ (to display multi line) but breaks other things like, in this case, ScrollTo.
May break the size of the scrollbar indicator too.
@Ricardo_Cruz is there a way to get the actual position of the of a WebListBox and scroll the WebListBox to it when the listbox rows have variable heights?
It seems counterintuitive to have a WebListBoxCellRenderer which allows you to do things like put variable height text in a list, but then it breaks something basic like ScrollTo.
At the very least, a documentation change warning ScrollTo doesn’t work with a WebListBox control if it has rows of differing heights seems warranted?
So it appears, every time the listbox is reloaded, the row numbers increment.
This makes the row number passed only work for the initial set of row numbers (after the first load). See sample attached project.
In my actual project, I’m keeping track of the number of rows loaded and appending this to the index (e.g. go to row 65 to go to the fifth visible row of a 20 row list box which has been reloaded three times)
This works but…
it’s clunky
it requires the call to the ‘ScrollIntoView’ extends method to be done from a WebTimer with a long enough period that the “dom has caught up”.
I appreciate all you’ve done already @Anthony_G_Cyphers , and I have a “fix”.
You’re much more familiar with JS in general and Xojo’s web framework use of it specifically than I am.
If there’s an easy way to “peak into the DOM” and figure out the first row number after the listbox reloads, that would be neat.
Otherwise, thanks for the assist and maybe @Ricardo_Cruz will be able to do something more definitively in a future Xojo update.