-
What do you want to achieve? Keep it simple and clear!
I have a TextBox of a fixed size with TextWrapping off. If the texts inside exceed the width of the textbox and I click at the end I want the TextBox’s view to stay at the end instead of snapping back to the start if the TextBox becomes unfocused. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I can’t seem to find any solutions to disable this default behaviour so I tried mimicking what I want by placing a TextBox inside a horizontal Scroll Frame container. The TextBox has AutomaticSize X and the scrollFrame has AutomaticCanvasSize X. If the scrolling frame’s AbsoluteCanvasSize.X increases I add the difference between the old and new AbsoluteCanvasSize.X into CanvasPosition.
This works well if I go to the end and add letters from there but it fails to achieve what the TextBox does anywhere else.
local OldAbsoluteCanvasSize = nil
ScrollFrameContainer:GetPropertyChangedSignal("AbsoluteCanvasSize"):Connect(function()
local NewAbsoluteCanvasSize = ScrollFrameContainer.AbsoluteCanvasSize.X
ScrollFrameContainer.CanvasPosition = Vector2.new(ScrollFrameContainer.CanvasPosition.X+(NewAbsoluteCanvasSize-OldAbsoluteCanvasSize))
OldAbsoluteCanvasSize = ScrollFrameContainer.AbsoluteCanvasSize.X
end)
Does anyone have any ideas to achieve this?