cs_MAsterC
Messages postés217Date d'inscriptionlundi 4 février 2002StatutMembreDernière intervention19 décembre 2012
-
8 mars 2005 à 00:15
cs_MAsterC
Messages postés217Date d'inscriptionlundi 4 février 2002StatutMembreDernière intervention19 décembre 2012
-
9 mars 2005 à 03:23
Salut à tous!
Tiré de la source de Costello, mIRC Reader.
procedure CheckBold(var S: string);
var IsOpen: boolean;
begin
{ Vérification du gras }
IsOpen := false;
while pos('',S)>0 do
begin
if not IsOpen then S := StringReplace(S,'','\b ',[])
else S := StringReplace(S,'','\b0 ',[]);
IsOpen := not IsOpen;
end;
if IsOpen then S := S + '\b0';
end;
procedure CheckUnder(var S: string);
var IsOpen: boolean;
begin
{ Vérification du soulignage }
IsOpen := false;
while pos('',S)>0 do
begin
if not IsOpen then S := StringReplace(S,'','\ul ',[])
else S := StringReplace(S,'','\ulnone ',[]);
IsOpen := not IsOpen;
end;
if IsOpen then S := S + '\ulnone';
end;
procedure CheckReverse(var S: string);
var IsOpen: boolean;
begin
{ Vérification du reverse }
IsOpen := false;
while pos('',S)>0 do
begin
if not IsOpen then S := StringReplace(S,'','\cf1\highlight2 ',[])
else S := StringReplace(S,'','\highlight0\cf0 ',[]);
IsOpen := not IsOpen;
end;
if IsOpen then S := S + '\highlight0\cf0';
end;
procedure CheckSingleColors(var S: string);
var i: integer; buf: string;
IsModified: boolean;
begin
IsModified := false;
for i := 15 downto 0 do
begin
buf := S;
S := AnsiReplaceStr(S,''+inttostr(i),'\cf'+inttostr(i+1)+' ');
if (buf<>S) then IsModified := true;
end;
if IsModified then S := S + '\cf0';
end;
procedure CheckDoubleColors(var S: string);
var i,j: integer; buf: string;
IsModified: boolean;
begin
IsModified := false;
for i := 15 downto 0 do
for j := 15 downto 0 do
begin
buf := S;
S := AnsiReplaceStr(S,''+inttostr(i)+','+inttostr(j),
'\cf'+inttostr(i+1)+'\highlight'+inttostr(j+1));
if (buf<>S) then ISModified := true;
end;
if IsModified then S := S + '\cf0\highlight0';
end;
Événement OnCreate de ma Form Principale
procedure TMainForm.FormCreate(Sender: TObject);
begin
List := TstringList.Create;
end;
for i := 0 to List.Count-1 do
begin
buf := List[i];
CheckBold(buf);
CheckUnder(buf);
Checkreverse(buf);
CheckDoubleColors(buf);
ChecksingleColors(buf);
buf := AnsiReplaceStr(buf,'','\highlight0\ulnone\b0\cf0 ');
OutPut.Add(buf+'\par');
end;
OutPut.Add('}');
TChannels.Lines.Add(Output.Text);
Output.Clear;
List.Clear;
OutPut.Free;
List.Free;
end;
Quand je reçoit mon message sur un canal, la premiere fois il s'affiche correctement avec les codes de couleurs voulu, cependant la 2ieme fois, il n'affiche plus rien etc... on voit juste le premier message et les autres on ne les recoits pas?
Comment faire?
Mon code n'est pas correct? Pourtant, il n'y a pas d'erreur.
cs_neko
Messages postés135Date d'inscriptionjeudi 14 août 2003StatutMembreDernière intervention12 octobre 20061 8 mars 2005 à 06:42
Si le code etait correct ça marcherait ;)
Je suis loin d'être un expert en codage rtf mais je pense que tu ne
peux afficher qu'un seul block de texte ( enfin c'est ce qu'il parait
le plus logique selon ta description du problème ).
essais ça:
Événement OnCreate du TidIRC ( enfin n'importe quel evennement au debut executé une seule fois )