EditText.selectAll and android 4 ?

jnbarban

Member
Licensed User
Longtime User
hi , i have a problem with "EditeTexte.SelectAll" function.

in my application, i use this to select all Text when user click on him :

B4X:
Sub txb_NombrePieces_FocusChanged (HasFocus As Boolean)
   txb_NombrePieces.SelectAll
End Sub

and

B4X:
Sub txb_NombrePieces_Click
   txb_NombrePieces.SelectAll
End Sub

work fine on Galaxy tab 1 ( Android 3)
on Galaxy Tab 2 ( Android 4 ), the texte is never selected. the cursor go on first position and this is all.
where is the probleme ?
 

SCIS

Active Member
Licensed User
Longtime User
If you only want to have the text selected when you actually focus the edittext and not when it loses the focus, you should do:
B4X:
Sub txb_NombrePieces_FocusChanged (HasFocus As Boolean)
    If HasFocus = True Then
        txb_NombrePieces.SelectAll
    End If
End Sub
I don't see why it wouldn't work on Android 4 though.
 
Upvote 0

jnbarban

Member
Licensed User
Longtime User
I'm trying your solution but the probleme are the same. when i clic on edittextbox, i see the curseur go at last position and just after, go at first.

but nothing was selected ??
 
Upvote 0

jnbarban

Member
Licensed User
Longtime User
works once every two ?

clic on txb1 --> nothing selected in txb1
clic on txb2 --> nothing selected in txb2
clic on txb1 --> txb1 selected
clic on txb2 --> txb2 selected
clic on txb1 --> nothing selected in txb1
clic on txb2 --> nothing selected in txb2
clic on txb1 --> txb1 selected
clic on txb2 --> txb2 selected
clic on txb1 --> nothing selected in txb1
clic on txb2 --> nothing selected in txb2
...

strange ?
 
Upvote 0

jnbarban

Member
Licensed User
Longtime User
Good Erel !!! Thanks

i have completed with :

B4X:
Sub txb_NombrePieces_TextChanged (Old As String, New As String)
   tmr.Enabled = False
End Sub

else the text is ever selected every X millisecond...
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
I would follow SCIS suggestion, and at the same time I would remove the editText_click handle.
 
Upvote 0
Top