I want to make it so when my text reaches the limit of the textbox, it becomes scrollable and creates more space for the cutoff text. When You type and it reaches the end of the textbox, it gets cutoff as shown here:
I’ve tried doing it myself and looking on the devforum and I’m still not quite sure of the most efficient way of going about this. My only way I can think of is either checking when textfits = false or by using textbounds.
You’re absolutely on the right track with TextFits and TextBounds. I’ve programmed solutions to similar problems using both in the past. I’d say the right choice for you depends on the context behind how the TextBox will be used. You can use a repeat loop beginning at 1*[Your Line Height] to define the YOffset of the TextBox, then increasing the 1 to 2, 3 an so on until TextFits == true. Alternatively, whenever the text is changed, you can set the TextWrapped property of the TextBox to false, forcing all the text to appear on a single line. This will update the TextBounds property which you can then simply divide the x component by the width (AbsoluteSize.X) of your TextBox to get how many lines will be required to fit all the text. In both cases I’d recommend adding one to a few extra lines just to make sure that the text is not clipped at the bottom. Also, you may have to run a few tests, I have not checked on this in a while but I remember running into an issue where the TextBounds property is not immediately accurate after setting the Text of a TextBox (which would throw off your calculations). Hope this helps!