trichview.support
Re: selection |
Author |
Message |
Sergey Tkachenko |
Posted: 03/10/2002 19:13:42 In Igor Afanasyev's TSyntaxRichViewEdit (a component descended from TRichViewEdit) http://www.trichview.com/resources/syntax/syntaxrichviewedit.zip there are methods converting RichView coordinates to "absolute" RichEdit coordinates and back: function ItemOffsToAbs(aItemNo, aOffs : integer) : integer; procedure AbsToItemOffs(aPos : integer; var aItemNo, aOffs : integer); procedure GetSelBounds(var aStart, aEnd : integer; var Inverted : boolean); procedure SetSelBounds(aStart, aEnd : integer; Inverted : boolean); function GetSelStart : integer; function GetSelEnd : integer; function GetSelLength : integer; procedure SetSelLength(aLen : integer); function GetAbsCaretPos : integer; procedure SetAbsCaretPos(aPos : integer) You can take implementations of these methos from there. Disclaimer: I did not test these methods thoroughly myself. These methods include calculations and may be slow for large documents. > It would make selection easier if selecting text could be abstracted to > selection within continuous plain text as an alternative. Non-text objects > could be represented as a special character - the whole object will be > selected if in the selection range (partial object selections (tables) can > be selected using the current methods). Invariably one is not interested in > how the text is divided up internally in items - if one could be spared > having to process through these internal items to arrive at the nth > character, it would be great. > eg: PlainText, PlainSelStart, PlainSelLen, PlainSelText properties > > |
Powered by ABC Amber Outlook Express Converter