ScrollViewer to adjust scroll position in code

I’m using ScrollViewer from Babylon GUI with a large amount of text that can be added over time. Is there a way that I can scroll this control to the bottom when I add new text?

I found this question from 2018, but it is not clear to be what I should do with _verticalBar (isn’t this meant to be private anyway?)

Related note: the ScrollViewer doesn’t follow platform conventions for on Oculus Quest. With the Quest controllers, users are used to scrolling content by pointing the cursor/laser at the scrollable region and using one of the thumb sticks. For now, this control seems limted to grabbing the scroll bar and moving it. Is there a way to get this working? Should I file a feature request for that?

We have options here: you can either do a PR and that will be awesome or file an issue and wait for someone to take it :wink:

I’m not sure I understand your reply. I can’t do a pull request when I don’t even know how to do this. The first part of my post was asking if there is a way in position the scrollbar via code. Your reply to the 2018 question indicates that it has something to do with _verticalBar, but that has dozens of properties on it. I don’t understand what to change about _verticalBar that would cause it to scroll to the bottom.

Sorry I was unclear: There is no “official way” to do it but if someone wants to give it a try and do a PR that would be great. Else I believe this is something we should have on the roadmap

cc @JohnK who built the scrollbars

Oh, ok. Got it. I’ll back burner it for now. I’ll trying to put together a short video and description of the other behavior that I described and will create a feature request for that.

Thank, Joseph

you should be able to set it with viewer.horizontalBar.value like in this post Use the VR interaction on ScrollViewer - #2 by syntheticmagus to control it by code

1 Like

That works for the first part of my post. I’m able to set verticalBar.value with a value of 1 to scroll the view to the bottom of the content. Now that I know that, maybe I can mock something up for the thumb stick scrolling when using WebXR

Thanks, Joseph

1 Like