iOS Question [Solved ???] Text Field - Focus to Beginning On Re-Orientation

RichardN

Well-Known Member
Licensed User
Longtime User
I have a TextView displaying some non-editable database information that is longer than the physical view... i.e. the text scrolls in & out of view.

By default, when the TextView is populated the focus remains at the end of the text with the beginning of the text out of view. TextView.ScrollTo(0) has results that appear related to the orientation of the view when it was first loaded.

Unfortunately, on device re-orientation executing the same command in the Page_Resize event appears to have no effect and the text is once again presented with only the last part of the text in view.

Is there a fix in code for this?

Edit: I appear to be seeing the behavior experienced by @imbault here: https://www.b4x.com/android/forum/threads/textview-scroll-to-the-begining.52233/

TextView.ScrollTo(0) has limited effect when used in the body of the code or in Page_Resize or Page_Appear events as the results seem unpredictable. I have tried making TextView.Editable = True momentarily to scroll to the top but it makes no difference.
 
Last edited:

RichardN

Well-Known Member
Licensed User
Longtime User
On further investigation:

In a TextView (Editable True or False) where the content is vertically too long to be displayed, the bottom of the text body is displayed by default.

Executing TextView.ScrollTo(0) in a user event like Button_Click works OK with the top of the text displayed correctly.

Executing TextView.ScrollTo(0) in an activity event like Page_Resize or Page_Appear does not work

Putting TextView.ScrollTo(0) into a Sub and calling via CallSubDelayed from Page_Resize or Page_Appear does not work

How to show the start of the text body on start and device re-orientation ???
 
Upvote 0

RichardN

Well-Known Member
Licensed User
Longtime User
A new day & a cold reboot...

I am now completely unable to reproduce the behaviour (end text focus) consistently observed yesterday. With TextView.ScrollTo(0) executed after the content is loaded in code the focus falls every time to the top of the text both initially & after reorientation.

I have absolutely no idea why.....
 
Upvote 0
Top