trichview.com

trichview.support




Re: Inserting a line with bullets


Return to index


Author

Message

Sergey Tkachenko

Posted: 07/28/2004 19:08:44


You are mixing two different kinds of methods - editing methods (InsertText,

InsertBullet) and viewer methods (AddNL).

Editing methods add items at the position of caret.

Viewer methods add items to the end of document. They should be used mostly

for generating new documents, not for inserting. If you use such method, any

editing method must be called only after the call of Format (otherwise the

program may crash) - it's dangerous to call InsertText right after AddNL.

Besides, you pass True to CaretBefore parameter of InsertText. Caret will be

positioned before the inserted text, and the next call of Insert*** method

will insert items before (not after) it.


The code may be


      RichViewEdit2.ReadOnly := False;

      RichViewEdit2.CurTextStyleNo := 3;

      RichViewEdit2.InsertText(#13'     '); // starting new line

      RichViewEdit2.InsertBullet(1, ImageList2);

      RichViewEdit2.InsertText(Msg);

      RichViewEdit2.ReadOnly := True;

Call of Format is not needed because only editing methods were used.



> Im trying to insert a line with a bullet without success.

> When a user click in a button i want to insert a line with a icon first of

> the text

> Every time when the button is clicked i want to insert a new line but is

not

> working very well.

> Look how is my code

>

> procedure X(Msg: String);

> begin

>      RichViewEdit2.ReadOnly := False;

>      RichViewEdit2.InsertText('     ',  True);

>      RichViewEdit2.InsertBullet(1, ImageList2);

>      RichViewEdit2.AddNL(Msg, 3, -1);

>      RichViewEdit2.InsertText('',  True);

>      RichViewEdit2.Format;

>      RichViewEdit2.ReadOnly := True;

> end;

>

> The result should be this when user clicked in button 3 times for example

>

>    <bullet> + Msg

>    <bullet> + Msg

>    <bullet> + Msg

>

> thanks

>

>





Powered by ABC Amber Outlook Express Converter