trichview.com

trichview.support




Re: Help with highliting text


Return to index


Author

Message

Peter

Posted: 12/01/2003 10:41:16


I get a stack overflow as sonn as I type 1 charecter. It pulls up at the

line in the RVstyle unit which reads


FTextStyles[StyleNo].Draw(s2, Canvas, StyleNo,

                     SpaceBefore, Left, Top, Width, Height, Self, DrawState,

Printing);


If I can't do it I am not fussed. I am simply looking for a way to show a

certain number of chars will be sent in a message and the rest will be

stored so maybe I will have to try something else.


Regards, peter

Sergey Tkachenko <[email protected]> wrote in message

news:[email protected]...

> Well, this is not so trivial (coloring the text completely, like they

> usually do in similar cases) would be much more easy.

>

> Ok, it looks like the code below works. But do not use it for very large

> documents.

> It assumes that the normal text attributes is in TextStyles[0], and red

text

> is in TextStyles[1].

>

> This code uses RVLinear unit. It is included in registered version of

> components, or can be downloaded here:

> http://www.trichview.com/support/files/rvlinear.zip

>

> // RichViewEdit1.OnChange

>

> procedure TForm3.RichViewEdit1Change(Sender: TObject);

> var SelStart, SelLength, Len: Integer;

> const Busy: Boolean = False;

>    MAXLEN = 300;

> begin

>   if not Busy then begin

>     Busy := True;

>     LockWindowUpdate(RichViewEdit1.Handle);

>     try

>       RVGetSelection(RichViewEdit1, SelStart, SelLength);

>       with RichViewEdit1 do

>         SetSelectionBounds(ItemCount-1, GetOffsAfterItem(ItemCount-1),

>           ItemCount-1, GetOffsAfterItem(ItemCount-1));

>       Len := RVGetLinearCaretPos(RichViewEdit1)-1;

>       if Len>MAXLEN then begin

>         RVSetSelection(RichViewEdit1, 1, MAXLEN);

>         RichViewEdit1.ApplyTextStyle(0);

>         RVSetSelection(RichViewEdit1, 1+MAXLEN, Len-MAXLEN);

>         RichViewEdit1.ApplyTextStyle(1);

>         end

>       else begin

>         RichViewEdit1.SelectAll;

>         RichViewEdit1.ApplyTextStyle(0);

>       end;

>       RVSetSelection(RichViewEdit1, SelStart, SelLength);

>     finally

>       LockWindowUpdate(0);

>     end;

>     Busy := False;

>   end;

> end;

>

>





Powered by ABC Amber Outlook Express Converter