R rabbit2 Member Jan 29, 2021 #1 How to position the cursor at the end of edittext when something is typed. Short . After pressing the button, I want the cursor to be positioned at the end of the text that was previously entered in edittext. Thank you
How to position the cursor at the end of edittext when something is typed. Short . After pressing the button, I want the cursor to be positioned at the end of the text that was previously entered in edittext. Thank you
M Mike1970 Well-Known Member Licensed User Longtime User Jan 29, 2021 #2 rabbit2 said: How to position the cursor at the end of edittext when something is typed. Short . After pressing the button, I want the cursor to be positioned at the end of the text that was previously entered in edittext. Thank you Click to expand... Is not the default behaviour to have the cursor always at the end? however you can use B4X: Sub EditText1_TextChanged (Old As String, New As String) EditText1.SelectionStart = EditText1.Text.Length End Sub Is this what you need? Upvote 0
rabbit2 said: How to position the cursor at the end of edittext when something is typed. Short . After pressing the button, I want the cursor to be positioned at the end of the text that was previously entered in edittext. Thank you Click to expand... Is not the default behaviour to have the cursor always at the end? however you can use B4X: Sub EditText1_TextChanged (Old As String, New As String) EditText1.SelectionStart = EditText1.Text.Length End Sub Is this what you need?
M Mahares Expert Licensed User Longtime User Jan 29, 2021 #3 Mike1970 said: Is this what you need? Click to expand... rabbit2 said: After pressing the button, I want the cursor to be positioned at the end of the text Click to expand... I think this is what he needed Mike, although it is not very clear from the question B4X: Sub EditText1_EnterPressed EditText1.SelectionStart = EditText1.Text.Length End Sub Upvote 0
Mike1970 said: Is this what you need? Click to expand... rabbit2 said: After pressing the button, I want the cursor to be positioned at the end of the text Click to expand... I think this is what he needed Mike, although it is not very clear from the question B4X: Sub EditText1_EnterPressed EditText1.SelectionStart = EditText1.Text.Length End Sub
M Mike1970 Well-Known Member Licensed User Longtime User Jan 29, 2021 #5 Mahares said: I think this is what he needed Mike, although it is not very clear from the question B4X: Sub EditText1_EnterPressed EditText1.SelectionStart = EditText1.Text.Length End Sub Click to expand... Ok ok it could be, the key factor is the “selection start” ? Upvote 0
Mahares said: I think this is what he needed Mike, although it is not very clear from the question B4X: Sub EditText1_EnterPressed EditText1.SelectionStart = EditText1.Text.Length End Sub Click to expand... Ok ok it could be, the key factor is the “selection start” ?