Is there a way to set the scroll position of a MobileTextArea by code?
In my case, text is added at the bottom and I want it to scroll down to the latest text after adding text.
The best way I’ve found to do this is to set the focus to the TextArea then set the SelectionStart property to the Length of the text:
TextArea1.Text = TextArea1.Text + EndOfLine + "New Line"
TextArea1.SetFocus
TextArea1.SelectionStart = TextArea1.Text.Length
Thanks Anthony, but this does not seem to work in Xojo2024R4.2 in combination with iOS 18.2.
Odd. That’s exactly what I tested.
Is your TextArea disabled? Try setting it Enabled. If that works, enable at the start, disabled at the end.
Works with Enabled = True or False, on both iPhone and iPad simulators here. In an iPad simulator, however, it’s not as nice due to the TextArea focus behavior, but does work.
You could switch to a Table if you don’t need to allow user input.
1 Like