Android Question Select EditText content when receiving focus

ThePuiu

Active Member
Licensed User
Longtime User
I have two EditText in one form. After completing the text in the first Edit, when you press the Next button on the keyboard, the cursor jumps to the second EditText. I would like the default text that exists in the second EditText to be selected so that the user can directly edit the content without deleting it. Now the cursor jumps before the existing text ... Can something like this be done?
Thank you!
 

Lucas Siqueira

Active Member
Licensed User
I have two EditText in one form. After completing the text in the first Edit, when you press the Next button on the keyboard, the cursor jumps to the second EditText. I would like the default text that exists in the second EditText to be selected so that the user can directly edit the content without deleting it. Now the cursor jumps before the existing text ... Can something like this be done?
Thank you!

B4X:
Private Sub EditText1_FocusChanged (HasFocus As Boolean)
    If HasFocus Then EditText1.SelectAll
End Sub

Private Sub EditText2_FocusChanged (HasFocus As Boolean)
    If HasFocus Then EditText2.SelectAll
End Sub

Screenrecorder-2022-01-21-08-02-36-959.gif
 

Attachments

  • ThePuiu.zip
    13.7 KB · Views: 40
Last edited:
Upvote 0
Top