Scrollto

Here are a few methods you can use. Add to a module and call as outlined in comments:

Public Sub scrollTo(extends c as WebContainer, X as Integer, Y as Integer)
  '// myContainer.scrollTo(10,100)
  if Session <> Nil then
    Session.ExecuteJavaScript( "var container = document.getElementById('" + c.ControlID + "');container.scrollTo(" + X.ToString + "," + Y.ToString + ");" )
  end if
End Sub
Public Sub scrollToBottom(extends c as WebContainer)
  '// myContainer.scrollToBottom
  if Session <> Nil then
    session.ExecuteJavaScript( "var container = document.getElementById('" + c.ControlID + "');container.scrollTop = container.scrollHeight - container.clientHeight;" )
  end if
End Sub
Public Sub scrollToTop(extends c as WebContainer)
  '// myContainer.scrollToTop
  if Session <> Nil then
    Session.ExecuteJavaScript( "var container = document.getElementById('" + c.ControlID + "');container.scrollTop = 0;" )
  end if
End Sub

I think this is multi-session safe. Not operating at 100% today. @Greg_O_Lone can say for sure.

4 Likes