Fórum Chat ajuda... #188090
11/10/2003
0
Ae fui inventa de o usuario escolher a cor do testo e talz...
So q fico um carnaval de cores...
ta feito assim o envia uma mensagem ´clBlue Ae´ teria o clBlue some e talz e o Ae fica azul e o resto do texto normal ´[/color]´ fiz mais ou menos assim so q eu num conseguindo fazer isso sera q alguem ja feiz isso essas frescuras de chat... q nem no messenger o usuario escolhe a cor e fonte q deseja e aparece pra outra pessoa , alguem sabe ???
Dark
Curtir tópico
+ 0Posts
12/10/2003
Alysson
faz o seguinte:
var
x:Tstringlist;
begin
x := Tstringlist.create;
x.values[´cmd´] := ´msg´;
x.values[´msg´] := ´aki quem fala é Alysson´;
x.values[´cor´] := ColorTostring(clBlue);
x.values[´fonte´] := ´Tahoma´;
x.values[´de´] := ´Alysson´;
chat.writeln(x.commatext);
end;
o texto ficaria assim:
cmd=msg
de=Alysson
cor=blue
fonte=Tahoma
msg=aki quem fala é Alysson
mas com commatext transforma para uma única linha....
pra receber o texto assim:
var
x:Tstringlist;
begin
x := Tstringlist.create;
x.commatext := chat.readln(´´,75);
// aí vai indo..... n lembro os códigos, mas daí vc usa StringToColor e talz
richedit.selstart := length(richedit.lines.text);
richedit.sellength := 0;
RichEdit.SelectionAttributes.color := clBlack;
richedit.selectionAttributes.style := [fsBold];
richedit.selectionAttributes.name := ´Arial´;
richedit.seltext := x.values[´de´];
richedit.selstart := length(richedit.lines.text);
richedit.sellength := 0;
RichEdit.SelectionAttributes.color := StringToColor(x.values[´cor´]);
richedit.selectionAttributes.name := x.values[´fonte´];
richedit.selectionAttributes.style := [] ;
richedit.seltext := x.values[´msg´];
end;
bem é +- isso.... v mais coisas sobre tStringList....
Gostei + 0
12/10/2003
Dark
Gostei + 0
12/10/2003
Alysson
o cliente manda o pacote de informações da msg... (eu expliquei isso).
o servidor ao ler a mensagem, ele envia para cada um cliente que estiver conectado à ele esse pacote....
com chat mais avançado pode se por
x.values[´para´] = ´canalX´;
qual comp vc ta usando para faze o chat??? aí eu vejo, e te mando o código direitinho...
Gostei + 0
12/10/2003
Dark
Gostei + 0
12/10/2003
Dark
Gostei + 0
12/10/2003
Alysson
procedure TForm1.serverClientWrite(Sender: TObject;
Socket: TCustomWinSocket);
var
i:integer;
q:Tstringlist;
begin
q := Tstringlist.create;
q.commatext := socket.ReceiveText;
if q.values[´cmd´] = ´msg´ then
begin
for i := 0 to server.Socket.ActiveConnections -1 do
begin
server.Socket.Connections[i].SendText(q.commatext);
end;
end;
end;
nunca mexi no Sockets, mas axo q é isso aew. to mexendo hoje. comecei hoje... e já to sacando...... to fazendo um cliente IRC.
se der erro, me avisa....
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)