Page 1 of 1

Caret at end of line

Posted: Tue Jul 04, 2023 7:36 am
by Dmitry Zaburyanov
Hi, Sergey!
Please help, how can I detect that caret at the end of line?

Little description: then I click right mouse button at empty space of RVE, caret position itself at end of clicked line, so GetCurrentWord return last word of it, but I want to return empty string. I think that detecting EOL will be enough)

Or may be there is another solution for my problem: I want to get item tag at click point, if no tag then word at click?

Thank you!

Re: Caret at end of line

Posted: Wed Jul 05, 2023 10:59 am
by Sergey Tkachenko
If you want to check if the specified (X,Y) position is inside some item, you can use GetItemAt() method with the parameter Strict = True.
If the specified position is outside any item, the method returns False.
Then you can get GetWordAt to get a word at the specified coordinates.

Please note that
- GetWords's input parameters (X,Y) are client coordinates (you can use parameters of OnMouseMove/Up/Down).
- GetItemAt's input parameters (X,Y) are document coordinates. Client coordinates can be converted to document coordinates using ClientToDocument method.