🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.language.objectpascal
Article #90

RichEdit and Streams

#90
From: Yehia Ahmed
Date: Mon, 26 Jan 2004 08:43
25 lines
1649 bytes
hello;

I read about tsreams object and how to modify the rtf code of the richedit
control,
as this we too complicated for me, i tried to load the rtf code in a
memo,modify it, and then use the save to strem to return back to richedit,

var Reg:Tregistry;
    SS:TstringStream;
    ReStr : Tmemo;
begin
ReStr:=    tmemo.Create(form1);
SS := tstringstream.Create('');
form1.MainText.Lines.SaveToStream(ss);
ReStr.Text := ss.datastring;
ReStr.Text := stringReplace(restr.Text,'Courier New','Tahoma',[]);
ss.Position := 0;
ss.WriteString(restr.Text ) ;
form1.MainText.Lines.LoadFromStream(ss);

the problem is in the last line, when executed the richedit text becomes '',
although the ss.datastring contain the right code, so why is this happening,

Thanks
Yehia
Technical Details
Message-ID: <4014d318@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 109d30,b3adc9c135a2402,start
X-Google-Attributes: gid109d30,public
X-Google-ArrivalTime: 2004-01-26 01:00:44 PST
From: "Yehia Ahmed" <yehiaeg@hotmail.com>
Newsgroups: borland.public.delphi.language.objectpascal
Subject: RichEdit and Streams
Date: Mon, 26 Jan 2004 10:43:00 +0200
Lines: 27
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2720.3000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2727.1300
NNTP-Posting-Host: 62.68.242.77
Message-ID: <4014d318@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1075106584 62.68.242.77 (26 Jan 2004 00:43:04 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail