Scoll canvas automatically based on contents

Is there a way to scroll a scroll bar automatically depending on the TextBounds or the amount of characters entered in a text box ?

With this removed I don’t think there’s a way

I don’t know what the best way to do this would be, a UI scale parented to the frame won’t work

I actually have an Open Soured Script builder where I did something like this:

1 Like

Your thread topic and the content of the thread raise two different points: one is to extend a scroll canvas based on the contents and the other is to scroll it based on a TextBox.

In general when it comes to scrolling the contents of the canvas, I will use a UIListLayout to automatically sort my items and then use AbsoluteContentSize.Y as the canvas height whenever something is added or removed. If I’m not using one, I’ll find the item with the highest Y offset, its Y size and then offset the canvas just a bit below that.

When it comes to resizing something based off of Text, just use GetPropertyChangedSignal on the TextBox so you can tell when it changes, then you can resize the textbox from there. I don’t know what your resize criteria is though.

If you’re looking to do something similar to the Lua Chat System, it uses the CalculateSize method from the ChatBar module to determine how the chat should resize itself. That is coupled with a Changed event on the TextBox.

1 Like