Page 1 of 1
					
				Get caret position of the selected text in screen
				Posted: Fri Jun 13, 2008 4:07 pm
				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.
			 
			
					
				
				Posted: Sat Jun 14, 2008 9:09 am
				by AutoCorect
				I found a solution: ScaleRichView.CaretPos. I now show the window above selection and seems to be ok.
			 
			
					
				
				Posted: Sat Jun 14, 2008 10:52 am
				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
			 
			
					
				
				Posted: Sat Jun 14, 2008 11:14 am
				by AutoCorect
				Thank you.