WebListBox scroll to bottom

Hello,

I am trying to figure out how to scroll a WebListBox to the bottom.

Is there a property or method of WebListBox that I can use to scroll the WebListBox to the bottom?

Sorry for being unclear. I meant that I want to scroll the WebListBox automatically to the bottom when I add a new row. This is a basic functionality. There must be something I could use, for example, a property that I can set or a method.

Add this method to a module.

Public Sub scrollToRow(extends l as WebListBox, rowIndex as Integer)
  '// Call as:
  '   myListbox.scrollToRow(99)
  if Session <> Nil then
    Session.ExecuteJavaScript( "$('#" + l.ControlID + "_table').dataTable().api().scroller.toPosition(" + rowIndex.toString("#0" ) + ")" )
  end if
End Sub

To scroll to the bottom, something like:

myListbox.scrollToRow(myListBox.RowCount - 1)
3 Likes

Thank you!

This should be added to Xojo as a native function, don’t you think so?

Sure, but I don’t have any control over that. It is a feature I’ve included on GraffitiGrid.

Don’t forget to mark a solution!

And to make a feature request using Feedback, if none already exists!

Already exists.
<https://xojo.com/issue/63466>

1 Like

Great!!!
You helped solve a big problem

THANK YOU!

 Giulio and Massimiliano
1 Like

Happy to help.