0 votes

I have a scrollcontainer and a label but when adding text the scrollcontainer does not autoscroll to follow the text.
How do I get it to follow when there is too much text on my label?

in Engine by (195 points)

Sorry, the answer I posted here earlier was intended for a different question (open in a different browser tab). I've hidden that answer and provided a new one...

1 Answer

0 votes

I assume you're trying to scroll things vertically as items are added to the bottom of the contained label? If that's the case, you can get access to the vertical scrollbar and set it to its maximum value when ever you add text. Here's some sample code snippets...

# Get a reference to the vertical scrollbar
onready var scrollbar = $ScrollContainer.get_v_scrollbar()

#  when you add text to the label, just scroll to the bottom...
$ScrollContainer/Label.text += "xxxx"
$ScrollContainer.scroll_vertical = scrollbar.max_value
by (16,666 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.