Jump to content

Scrollviewer, couple questions


Recommended Posts

Hi, I had a couple questions about the ScrollViewer GUI component.

  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.
    1. A playground probably demos this best: https://www.babylonjs-playground.com/#3EF49E#11 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!


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...