Android Question How to position the cursor at the end of edittext when something is typed.

rabbit2

Member
How to position the cursor at the end of edittext when something is typed.

Short . After pressing the button, I want the cursor to be positioned at the end of the text that was previously entered in edittext. Thank you
 

Mike1970

Well-Known Member
Licensed User
Longtime User
How to position the cursor at the end of edittext when something is typed.

Short . After pressing the button, I want the cursor to be positioned at the end of the text that was previously entered in edittext. Thank you
Is not the default behaviour to have the cursor always at the end?

however you can use

B4X:
Sub EditText1_TextChanged (Old As String, New As String)
    EditText1.SelectionStart = EditText1.Text.Length
End Sub

Is this what you need?
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
Ok ok it could be, the key factor is the “selection start” ?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…