• Welcome to Valhalla Legends Archive.
 

[Delphi] AddC Porting

Started by PaiD, August 04, 2005, 01:16 AM

Previous topic - Next topic

PaiD

Ok I am tring to port Grok's AddC in VB Function into Delphi. I got close but not to close >.< Here is what I have. (I cant find out how to Array it to allow many colors)

procedure TfrmMain.AddC(Color: Integer; Text: String);
begin
  frmMain.Chat.SelStart := Length(frmMain.Chat.Text);
  frmMain.Chat.SelLength := 0;
  frmMain.Chat.SelAttributes.Color := Color;
  frmMain.Chat.SelText := Text;
  frmMain.Chat.SelStart := Length(frmMain.Chat.Text);
  frmMain.Chat.Seltext := #10;
end;


Usage:
AddC(clYellow,'Delphi Chat');
AddC(clLime,'Version: 1.0');
AddC(clRed,'By Savior');

Also I had to add 'Seltext := #10' so it would drop to the other line.
Any help/ideas would be nice :)