trichview.support
Re: inserting text + applytextstyle ? |
Author |
Message |
Sergey Tkachenko |
Posted: 07/22/2003 19:07:22 Actually, it is simple: rve.CurTextStyleNo := 4; rve.InsertText(....); // or rve.InsertStringTag() As for your code. GetCurrentLineCol and SetSelectionBounds are not complementary methods. GetSelectionBounds and SetSelectionBounds are. GetCurrentLineCol returns line and column indices in the text, not an index of item and offset in it. > hello, > > for dropping URLs, I insert the title and set the tag to the URL, > like is done in the createhyperlink example. > As long as I insert texts before other insertion points, > everything works perfect. > But as soon as I insert a textstring (I forget about the URL for a > moment), after another insertion position, > the selection is made wrong. > > The routine below should insert "text" and give "ex" textstyle=4. > When I leave the "applytextstyle" out, the "ex" should be highlighted > (selected). This works correct at any place. > Any idea what is wrong with the applytextstyle steatement ? > > MoveCaretTo(Point.X,Point.Y); > richviewedit1.GetCurrentLineCol(start_itemno,start_offset); > richviewedit1.InsertText(#13+'text'+#13,false); > start_offset:=2; > end_itemno:=start_itemno; > end_offset:=start_itemno+length('text')-2; > richviewedit1.SetSelectionBounds( > start_itemno,start_offset,end_itemno,end_offset); > RichViewEdit1.ApplyTextStyle(4); > richviewedit1.Invalidate; > > thanks, > Stef Mientki > |
Powered by ABC Amber Outlook Express Converter