A TextBox increasing in size as more text is added with a ScrollingFrame

Hey everyone. I’m looking to create a TextBox that is parented to a ScrollingFrame that will increase in size as more text is added to it. As in, the ScrollingFrame will be able to scroll further and further as text is added. I’ve tried multiple solutions on the DevForum but haven’t been able to get this issue to work. Instead, once the text reaches the bottom of the TextBox, it just leaves an ellipsis. If this is something that isn’t actually possible, well then… rip.

image

I figured something like this would be possible using native properties in the ScrollingFrame and TextBox, without the use of scripts.

Here’s the text properties for the TextBox, and Scrolling for the ScrollingFrame:

image

1 Like

Shouldn’t you also set TextBox.AutomaticSize to Y too?

Also consider putting in a UIListLayout in the ScrollingFrame so the frame properly scales when the textbox scales.

1 Like

The AutomaticSize is already Y. Just tried the UIListLayout, it still hasn’t worked.

1 Like

Try setting CanvasSize.Y to 0. Maybe that’s why.

1 Like

That hasn’t fixed it either unfortunately

1 Like

It’s hard to tell what exactly are you trying to do. Additionally, sending the size properties (under the Data category on the properties window) and the entire image of the scrolling frame would help.

I just tried filling a ScrollingFrame with a UIListLayout with a TextBox as the last object and can replicate your behavior and fix the issue by simply setting the TextBox’s AutomaticSize to Y.

Hey, thanks for the reply. I tried your solution and it didn’t work. Here’s a video of the behaviour I got:
https://gyazo.com/b4e40b63327703affab5d53cf8802cf7

Properties of the ScrollingFrame and TextBox (size of TextBox is overridden by a constraint):

Credit to @SpawnlessNoob for the solution!

image

local text_box = script.Parent.TextBox

local function resize()
	scroll_frame.CanvasSize = UDim2.fromOffset(0, 100000)
	scroll_frame.CanvasSize = UDim2.fromOffset(0, text_box.TextBounds.Y)
end

text_box:GetPropertyChangedSignal("Text"):Connect(resize)
resize()

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.