Get caret position of the selected text in screen

General TRichView support forum. Please post your questions here
Post Reply
AutoCorect
Posts: 84
Joined: Sun Dec 16, 2007 7:15 pm

Get caret position of the selected text in screen

Post by AutoCorect »

Hi.

I want to show a window just below text selection in ScaleRichView.
I don't know how to find the position of the selected text (even in tables) in Screen coordinates. I tried with GetItemClientCoords, GetSelectionRect and ClientToScreen API but no luck so far.
Can anyone help me, please...

Thank you in advance.
AutoCorect
Posts: 84
Joined: Sun Dec 16, 2007 7:15 pm

Post by AutoCorect »

I found a solution: ScaleRichView.CaretPos. I now show the window above selection and seems to be ok.
proxy3d
ScaleRichView Developer
Posts: 307
Joined: Mon Aug 07, 2006 9:37 am

Post by proxy3d »

See also:
convertRVtoSRV(p : TPoint) : TPoint; - converting of coordinates RV in coordinates SRV.
p - position in RichView
Result - position in ScaleRichView

convertSRVtoRV(p : TPoint; var InArea, bInLeft : Boolean) : TPoint; - converting of coordinates SRV in coordinates RV.
InArea - to be inside of area of page or not. True - inside.
bInLeft - to be at the left or on the right, if InArea = True.

function GetCaretPosInUnits(Units: TRVUnits; var CaretPosX, CaretPosY : Extended) : Boolean;
Units - a unit of measure of coordinates in SRV.
CaretPosX, CaretPosY - a position of the caret.

function GetRVCaretPos(var PageNo : Integer) : TPoint;
returns a position of the caret in coordinates RV
PageNo - number of page in which is the caret.

property CaretPos : TPoint;
position of the caret in coordinates SRV
AutoCorect
Posts: 84
Joined: Sun Dec 16, 2007 7:15 pm

Post by AutoCorect »

Thank you.
Post Reply