Scrollviewer, couple questions

Hi, I had a couple questions about the ScrollViewer GUI component. Nice new digs!

  1. Is it possible from code to set the vertical or horizontal bar value, say based on some event (in my case, new text being added to a TextBlock inside the ScrollViewer)? For example, I may want to set the vertical scrollbar to the bottom when new text is appended to the end.
  2. I notice that if a scrollViewer is set to the bottom of content that is larger than the scrollViewer, if new content is added, it doesn’t seem to update properly.
  3. A playground probably demos this best: After loading the scene, scroll the ScrollViewer to the bottom before 5 seconds is up and the setTimeout events start firing to update the TextBlock inside the scrollviewer. Until you manually scroll up and down again, the new content isn’t shown.

I was able to solve the first item in my own fork of the ScrollViewer, but for the second, I had issues unless I used delayed events (via setTImeout) to alter the scrollbar values, which I suspect was because without the delay the new size of the TextBlock wasn’t calculated or something to that effect. using textBlock.onTextChangedObservable still seemed to be too early (I tried other variations which I don’t recall now).

Thanks as always for this wonderful engine!

Hello and welcome to our new home :wink:

  1. Not yet but this is as easy as exposing scrollViewer._horizontalBar and _verticalBar
  2. Let me check what I can do :slightly_smiling_face:

I’ll fix 1 as well while being at it

Ok both are fixed and will be in next commit!


You rock!