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()
 
B4A_VqjhyxB8Vk.png
 
Upvote 0
Or to select the end of the text in the EditText, you can use the code from Klaus:

B4X: Copy
EditText1.Text = "Test"
EditText1.RequestFocus
EditText1.SelectionStart = EditText1.Text.Length
 
Upvote 0
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?

Code: Copy
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
Firstly welcome to the community, may you have many many many hours of great app development using the full suite of B4X development tools. Now lets answer your question.

The TextBox (EditText) can be selected with TextBox.Select() in .NET. Why is RequestFocus() on B4A?

Because B4A is not a M$ product like VS ;)
 
Upvote 0
B4A: Textbox1.RequestFocus
VB.NET: Textbox1.Focus()

IMO, RequestFocus in B4A is more powerful as it returns True if the focus was set.
 
Upvote 0
Back
Top