trichview.support
Re: TRichViewEdit, set caret at X,Y coordinates ? |
Author |
Message |
Sergey Tkachenko |
Posted: 07/20/2003 16:27:18 // X,Y - coordinates relative to the top left corner // of the editor window uses CRVFData; procedure TForm1.MoveCaretTo(X, Y: Integer); var RVData: TCustomRVFormattedData; ItemNo, Offs: Integer; begin inc(X, RichViewEdit1.HScrollPos); inc(Y, RichViewEdit1.VScrollPos*RichViewEdit1.VSmallStep); RichViewEdit1.GetItemAt(X,Y,RVData,ItemNo,Offs, False); RVData := RVData.Edit as TCustomRVFormattedData; if ItemNo<0 then exit; RVData.SetSelectionBounds(ItemNo, Offs, ItemNo, Offs); RVData.Invalidate; end; This code cannot be called directly from some events (including OnMouseMove and OnDrawOver), only via PostMessage. See example in Demos\Delphi\Assorted\Graphics\DragImg\ > hello, > > Is there a way to set the caret (of TRichViewEdit) at a certain > location, given by there X and Y coordinates. > I want to implement a simple drag-drop facility (which I understand > won't be implemented before version 1.9). > > thanks, > Stef Mientki > |
Powered by ABC Amber Outlook Express Converter