trichview.support
Re: Inserting a letter at leftmost - DO GIVE an example,please |
Author |
Message |
Sergey Tkachenko |
Posted: 03/14/2003 14:35:30 This procedure inserts the text s at the beginning of the caret paragraph, then returns caret to the original position. It uses functions from http://www.trichview.com/support/files/rvlinear.zip But if you want to implement paragraph bullets/numbering, it's much better to use corresponding RichView features instead. procedure InsertTextAtTheParaStart(rve: TCustomRichViewEdit; const s: String); var Pos, ItemNo, Offs: Integer; begin // if you need to work with item indices, always // work with top-level cell editor rve := rve.TopLevelEditor; // storing caret position - a number of characters // from the beginning of document to caret + Length(s) Pos := RVGetLinearCaretPos(rve)+Length(s); // searching for the beginning of paragraph ItemNo := rve.CurItemNo; while not rve.IsParaStart(ItemNo) do dec(ItemNo); Offs := rve.GetOffsBeforeItem(ItemNo); // moving caret to the beginning of paragraph rve.SetSelectionBounds(ItemNo, Offs, ItemNo, Offs); // inserting text rve.InsertText(s); // returning caret back RVSetLinearCaretPos(rve, Pos); end; > > Hello Sergey, > Do give an example on 'move caret to the beginning' and insert text. > > Thanks. > > "Sergey Tkachenko" <[email protected]> wrote: > >If your question is related to bullets/numbering, see my previous answer. > >Otherwise - save caret positon, move caret to the beginning, insert text, > >move caret back (I can give an example, if you want) > > > > > >> > >> Hello, > >> My cursor is placed in the middle of a given paragraph. How do I insert > a > >> letter manually at the leftmost of a paragraph. > >> > >> Thanks. > >> > > > > > |
Powered by ABC Amber Outlook Express Converter