Scrollto

Try redownloading it? It’s possible I changed it earlier after you downloaded it. I’ve worked on 14 different projects today, so anything is possible. I can tell you that the version I downloaded from the link I supplied has that.

At any rate, the logic is the same. Load cells in Open, ScrollToBottom in Shown or at some point after.

The code works, you just need to implement in a way that works for you. These implementation details are likely going to be very project-specific, so you’re essentially on your own there, but bear in mind that you can use Timer.CallLater after adding items to help ensure that the scroll code executes after the containers are embedded.

That makes sense. The difference is still that I’m adding the container in real time. I have to believe it’s the asynchronous problem where it’s running your command before the container is visible so that the command thinks it’s at the bottom.

Thanks. I can’t get timer.calllater to work. I’m getting an error on the command “timer.callLater(2000, addressOf scrollToBottom)” that ‘there is more than one method with this name and this does not match any of the available signature’

Yeah, thinking more about it, that’s probably not the best way to go as it won’t be Session-aware. To make things simple, you can add a Timer to your WebContainer with the following properties:

  • Name: tmrScroll
  • RunMode: Off
  • Period: 100
  • Location: Server

In the Run event of the timer:

self.scrollToBottom

Then, in the WebContainer’s Shown event:

tmrScroll.RunMode = WebTimer.RunModes.Single

Thanks . . . Figgered out the same solution. Although I think the location should be ‘browser’.

Setting the timer to Browser will add a bit more time for the round-trip. Whatever works best for you.

Scroll to left and right?

See the scrollTo method in this post above, and supply a value to the x parameter:

These should work, though untested.

Public Sub scrollToLeft(extends c as WebContainer)
  '// myContainer.scrollToLeft
  if Session <> Nil then
    session.ExecuteJavaScript( "var container = document.getElementById('" + c.ControlID + "');container.scrollLeft = 0;" )
  end if
End Sub
Public Sub scrollToRight(extends c as WebContainer)
  '// myContainer.scrollToRight
  if Session <> Nil then
    Session.ExecuteJavaScript( "var container = document.getElementById('" + c.ControlID + "');container.scrollLeft = container.scrollWidth - container.clientWidth;" )
  end if
End Sub