Android Question How to set EditText cursor position Y?

T201016

Active Member
Licensed User
Longtime User
Hi!
Is it possible to be able to set the cursor to the "Y" position in EditText or FloatLabeledEditText?
I miss just such a method "edittext.scrollY() ..."
 

William Lancee

Well-Known Member
Licensed User
Longtime User
For B4XFloatTextfield.Textfield and EditText1

B4X:
    B4XFloatTextField1.TextField.RequestFocus
    B4XFloatTextField1.TextField.SetSelection(cursorPosition, 0)

    EditText1.RequestFocus
    EditText1.SetSelection(cursorPosition, 0)
 
Upvote 2

William Lancee

Well-Known Member
Licensed User
Longtime User
If you have a multiline view, and you want to move cursor to line i, you have to find the cursor position of the start of line i.
Not really a big challenge.
 
Upvote 0

T201016

Active Member
Licensed User
Longtime User
Welcome William,

Thank you for the valuable hint, and if you are already in the topic, there is probably a method to obtain programmatic multiline scrolling in edittext, similar to: ScrollY = joEditText.RunMethod ("getScrollY", Null). My idea is to get the effect that I will scroll EditText1 manually, and at the same time have it programmatically scroll itself in another EditText2.
 
Upvote 0
Top