J jnbarban Member Licensed User Longtime User Nov 27, 2012 #1 hi , i have a problem with "EditeTexte.SelectAll" function. in my application, i use this to select all Text when user click on him : Code: Copy Sub txb_NombrePieces_FocusChanged (HasFocus As Boolean) txb_NombrePieces.SelectAll End Sub and Code: Copy 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 ?
hi , i have a problem with "EditeTexte.SelectAll" function. in my application, i use this to select all Text when user click on him : Code: Copy Sub txb_NombrePieces_FocusChanged (HasFocus As Boolean) txb_NombrePieces.SelectAll End Sub and Code: Copy 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 ?
S SCIS Active Member Licensed User Longtime User Nov 27, 2012 #2 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: Code: Copy 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
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: Code: Copy 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.
J jnbarban Member Licensed User Longtime User Nov 27, 2012 #3 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
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 ??
Erel B4X founder Staff member Licensed User Longtime User Nov 27, 2012 #4 Try this: Code: Copy Sub txb_NombrePieces_FocusChanged (HasFocus As Boolean) If HasFocus = True Then CallSubDelayed(Me, "SelectAll") End If End Sub Sub SelectAll txb_NombrePieces.SelectAll End Sub Upvote 0
Try this: Code: Copy Sub txb_NombrePieces_FocusChanged (HasFocus As Boolean) If HasFocus = True Then CallSubDelayed(Me, "SelectAll") End If End Sub Sub SelectAll txb_NombrePieces.SelectAll End Sub
J jnbarban Member Licensed User Longtime User Nov 27, 2012 #5 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
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 ?
Erel B4X founder Staff member Licensed User Longtime User Nov 27, 2012 #6 The problem is that EditText internally manages the selection when the focus changes. You can try to use a short timer instead of CallSubDelayed. Upvote 0
The problem is that EditText internally manages the selection when the focus changes. You can try to use a short timer instead of CallSubDelayed.
J jnbarban Member Licensed User Longtime User Nov 27, 2012 #7 Good Erel !!! Thanks i have completed with : Code: Copy 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
Good Erel !!! Thanks i have completed with : Code: Copy Sub txb_NombrePieces_TextChanged (Old As String, New As String) tmr.Enabled = False End Sub else the text is ever selected every X millisecond...
mc73 Well-Known Member Licensed User Longtime User Nov 27, 2012 #8 I would follow SCIS suggestion, and at the same time I would remove the editText_click handle. Upvote 0