Caret at end of line

General TRichView support forum. Please post your questions here
Post Reply
Dmitry Zaburyanov
Posts: 24
Joined: Fri Mar 25, 2011 12:59 pm

Caret at end of line

Post 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!
Sergey Tkachenko
Site Admin
Posts: 17602
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Caret at end of line

Post 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.
Post Reply