what event is triggered on edittext

hung

Active Member
Licensed User
Longtime User
I have an edittext with multiple lines enabled but select Input Type=None.

I have load te edittext with content of a text file and i could scroll the content up and down.

But I cannot get the position of current cursor in the edittext and i don't know which event is triggered.

Could anyone help? :sign0085:
 

mc73

Well-Known Member
Licensed User
Longtime User
I think you can use a timer, and when you have a change in cursor position, show it. Cursor position is found by using the .selectionStart property of edittext.
See the attached example. I'm no expert, surely there has to be a more ellegant and easy way to acomplish this.
 

Attachments

  • edittextselectiontypenone.zip
    6.8 KB · Views: 259
Upvote 0

stevel05

Expert
Licensed User
Longtime User
If you type Sub in the ide, then press Space then Tab and select EditText, you can see the methods available. There is not an event that captures scroll.

From my tests if you have inputtype = None, there is no visible cursor in the text.

What are you trying to achieve?
 
Upvote 0

hung

Active Member
Licensed User
Longtime User
If you type Sub in the ide, then press Space then Tab and select EditText, you can see the methods available. There is not an event that captures scroll.

From my tests if you have inputtype = None, there is no visible cursor in the text.

What are you trying to achieve?

I have a edittext with type NONE for showing content of a text file for reading. now i could show and scroll up and down. But then when orientation changed, the edittext jump back to first line.

I want to keep current position of what is showing but don‘t know how. There is no event and not cursor position. selection start works but the keyboard prompt up and may update my content in edittext.

no clue yet:-(
 
Upvote 0

hung

Active Member
Licensed User
Longtime User
I think you can use a timer, and when you have a change in cursor position, show it. Cursor position is found by using the .selectionStart property of edittext.
See the attached example. I'm no expert, surely there has to be a more ellegant and easy way to acomplish this.


Thanks. But i don‘t want to change anything in the edittext so I don’t TEXT so i guess selectionstart return nothing.
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
Thanks. But i don‘t want to change anything in the edittext so I don’t TEXT so i guess selectionstart return nothing.
If you test the small example I've uploaded, you will see that selectionstart returns the cursor position. No need to type something in, afterall this was the reason you orginally set inputType to none, isn't it? :)
 
Upvote 0

hung

Active Member
Licensed User
Longtime User
If you test the small example I've uploaded, you will see that selectionstart returns the cursor position. No need to type something in, afterall this was the reason you orginally set inputType to none, isn't it? :)

Yes you are right. I just got a chance to see your example. It works. Thanks. :icon_clap:
 
Upvote 0
Top