[Help] RichView concatening last lines

General TRichView support forum. Please post your questions here
Post Reply
MaskMaster
Posts: 4
Joined: Tue Jan 27, 2009 5:00 pm

[Help] RichView concatening last lines

Post by MaskMaster »

Hi, people. I'm creating a chat using code from a example called "IrcColors", that can be found in this forum, and when i receive a certain amount of lines the TRichview concat last lines, transforming then in a text and so on as new lines appear. Tanks for the help, I dont know if its a property or a method this function is calling.
procedure ParseString(TextaAfficher: String; Rv : TRichView);
var
I, J, K, ParaNo, StyleNo : Integer;
TextAff, Temp : String;
Color, BkColor,TempBack : tColor;

function GetCouleur: tColor;
var C1, C2: Char;
begin
Result := ClNone;
C1 := TextaAfficher[i + 1];
C2 := TextaAfficher[i + 2];
if IsNum(C1 + C2) then begin
result := IRC_COLORS[StrToInt(C1 + C2)];
inc(i,2);
end else
if IsNum(C1) then begin
result := IRC_COLORS[StrToInt(C1)];
inc(i);
end;
end;

function GetCouleurFond: tColor;
var
C1, C2: Char;
begin
Result := BkColor;
if TextaAfficher[i + 1] = ',' then begin
C1 := TextaAfficher[i + 2];
C2 := TextaAfficher[i + 3];
if IsNum(C1 + C2) then begin
result := IRC_COLORS[StrToInt(C1 + C2)];
inc(i,3);
end
else
if IsNum(C1) then begin
result := IRC_COLORS[StrToInt(C1)];
inc(i,2)
end;
end;
end;

begin
FPrincipal.Canvas.Lock;
ParaNo := -1;
StyleNo := 0;
I := 1;
BkColor := ClNone;
while i <= Length(TextaAfficher) do begin

case TextaAfficher of

#3 : begin
Color := GetCouleur;
BkColor := GetCouleurFond;
StyleNo := GetStyleNo(#3, Color, BkColor, StyleNo,'',Rv);
inc(i);
end;

#2, #9, #15, #22, #31 : begin
StyleNo := GetStyleNo(TextaAfficher, ClNone, ClNone, StyleNo,'',Rv);
inc(i);
end;
else begin

Textaff := '';
Temp := '';
// si c'est des caracteres affichables on boucle
while not (TextaAfficher in [#2, #3, #9, #15, #22, #31]) and (i <= Length(TextaAfficher)) do
begin
Temp := Temp + TextaAfficher;
TextAff := TextAff + TextaAfficher ;
//------------------------------------------------------------------------------
If (TextaAfficher = ' ') or (i = Length(TextaAfficher)) then begin
K := 0;
While K < 49 do begin
If UpperCase(Trim(Temp)) = Smiles[K] then begin
if i = Length(TextaAfficher) Then J := 0 else J := 1;
RV.AddNL(LeftStr(TextAff,Length(TextAff)-Length(Smiles[K]) - J), StyleNo, ParaNo);
RV.AddBulletEx('', K, FPrincipal.ImgListEmoticom, ParaNo);
TextAff := ' ';
K := 999;
End;
Inc(K);
end;
Temp := '';
end;
//------------------------------------------------------------------------------
inc(i);
end;
rv.AddNL(Textaff, StyleNo, ParaNo);
end;
end;
end;
rv.FormatTail;
FPrincipal.Canvas.UnLock;
end;


P.S: Sorry for the bad englis!!! XD
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

You use ParaNo=-1. It means adding to the same paragraph.
Post Reply