Android Question Select EditText Box

Akacoo

New Member
TextBox (EditText) can be selected with TextBox1.Select() in VS. I can't do the same on B4A. :(
Example: EditText1.Select()
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
B4A_VqjhyxB8Vk.png
 
Upvote 0

Mark Read

Well-Known Member
Licensed User
Longtime User
Or to select the end of the text in the EditText, you can use the code from Klaus:

B4X:
EditText1.Text = "Test"
EditText1.RequestFocus
EditText1.SelectionStart = EditText1.Text.Length
 
Upvote 0

Akacoo

New Member
It was not SelectAll. I finally found it. It would be RequestFocus.
The TextBox (EditText) can be selected with TextBox.Select() in .NET. Why is RequestFocus() on B4A?

B4X:
Sub CheckBox1_CheckedChange(Checked As Boolean)
    If CheckBox1.Checked = True Then
        EditText1.Enabled=True
        IME.ShowKeyboard(EditText1)
        EditText1.RequestFocus()
    Else
        EditText1.Enabled=False
        EditText1.Text = ""
        Spinner1.Visible=False
    End If
End Sub
 
Upvote 0
Top