Recent

Author Topic: Pulling RichText from a RichMemo  (Read 4627 times)

WildMan

  • New Member
  • *
  • Posts: 22
Pulling RichText from a RichMemo
« on: July 13, 2012, 11:33:58 pm »
I'm using the following block of code to pull the RichText from a tRichMemo and shove it in a string.  It works in Delphi but on my Mac, under Lazarus, it does a hard crash on the line RE.SaveRichText(Stm).

Anybody see a problem with this code or have a better way to accomplish this?
 
function tForm1.RTFToString(RE: tRichMemo): String;
var Stm: tMemoryStream;
    MyList: tStringList;
begin
  Stm:=tMemoryStream.Create;
  try
    RE.SaveRichText(Stm);
    Stm.Position:=0;
    MyList:=tStringList.create;
    try
      MyList.LoadFromStream(Stm);
      Result:=MyList.Text;
    finally
      MyList.Free;
    end;
  finally
    Stm.Free;
  end;

 

TinyPortal © 2005-2018