am trying to rebuild my chat content by storing it into a stringlist first and then re-pushing it out but problem am having is with my font settings i can not work out how to add my font styles to the string has anyone got any code to show how this is done?

thanks alot

I would use a XML to store all the informations that you will need, the font, the text and etc.Try to do something like this:

<?XML version="1.0"?>
<FirstGuy>
<font>clRed</font>
<content>Hello my friend.</content>
</FirstGuy>
<SecondGuy>
<font>clRed</font>
<content>Hello FirstGuy</content>
</SecondGuy>
function StrToColor(Value: string): TColor;
begin
  Value := UpperCase(Value);
  if Value = 'BLACK' then
    Result := clBlack
  else if Value = 'MAROON' then
    Result := clMaroon
  else if Value = 'GREEN' then
    Result := clGreen
  else if Value = 'OLIVE' then
    Result := clOlive
  else if Value = 'NAVY' then
    Result := clNavy
  else if Value = 'PURPLE' then
    Result := clPurple
  else if Value = 'TEAL' then
    Result := clTeal
  else if Value = 'GRAY' then
    Result := clGray
  else if Value = 'SILVER' then
    Result := clSilver
  else if Value = 'RED' then
    Result := clRed
  else if Value = 'LIME' then
    Result := clLime
  else if Value = 'YELLOW' then
    Result := clYellow
  else if Value = 'BLUE' then
    Result := clBlue
  else if Value = 'FUCHSIA' then
    Result := clFuchsia
  else if Value = 'AQUA' then
    Result := clAqua
  else if Value = 'WHITE' then
    Result := clWhite
  else
    Result := clBlack;
end;
var
   Node, Noode : IXMLNode;
begin
   Node := XMLDocument1.DocumentElement.ChildNodes.FindNode('FirstGuy');
   if (node <> nil) then
   begin
      Memo1.Lines.Add(Node.ChildNodes['content'].Text);
   end;
   Noode := XMLDocument.DocumentElement.ChildNodes.FindNode('SecondGuy');
   if (noode <> nil) then
   begin
   Memo1.Lines.Add(Noode.ChildNodes['content'].text);
   end;
   Memo1.Font.Color := StrToColor(Node.ChildNodes['font'].text);
end;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.