Board index » delphi » Copy Contents of one TRichEdit To Another TRichEdit?

Copy Contents of one TRichEdit To Another TRichEdit?

How do I copy the formatted text contained in one TRichEdit control into
another TRichEdit control?  Simply assigning the text properties behaves as
if the PlainText properties are set to true (which they are not). I can copy
and paste to and from the clipboard and the formatted text transfers
properly. I'm thinking I need to use streams, but don't know how to get
started with that.

I also need to assign and read formatted text to and from a (xBase Advantage
flavor) DBF file. Is a memo field OK or must the field be a BLOB. Streams
again?

I'd truly appreciate some examples and/or pointers to good documentation --
Delphi's is a bit terse for me yet.

Thanks

Al Wimberly

 

Re:Copy Contents of one TRichEdit To Another TRichEdit?


  RichEdit1.SelectAll;
  RichEdit1.CopyToClipboard;
  RichEdit2.PasteFromClipboard;

Quote
"Al Wimberly" <del...@codethree.com> wrote in message

news:3ecc62a7@newsgroups.borland.com...
Quote
> How do I copy the formatted text contained in one TRichEdit control into
> another TRichEdit control?

Re:Copy Contents of one TRichEdit To Another TRichEdit?


Yep, I know that. However, I don't want to clutter up the clipboard. Is
there a more "direct" transfer method?

Quote
"Jari Kettunen" <jar...@hotmail.com> wrote in message

news:3ecc676f$1@newsgroups.borland.com...
Quote
>   RichEdit1.SelectAll;
>   RichEdit1.CopyToClipboard;
>   RichEdit2.PasteFromClipboard;

> "Al Wimberly" <del...@codethree.com> wrote in message
> news:3ecc62a7@newsgroups.borland.com...
> > How do I copy the formatted text contained in one TRichEdit control into
> > another TRichEdit control?

Re:Copy Contents of one TRichEdit To Another TRichEdit?


Following seems to work.

procedure TForm1.Button3Click(Sender: TObject);
var
  TempStream : TMemoryStream;
begin
  TempStream := TMemoryStream.Create;
  RichEdit1.Lines.SaveToStream(TempStream);
  TempStream.Position := 0;
  RichEdit2.Lines.LoadFromStream( TempStream);
  TempStream.Free;
end;

Quote
"Al Wimberly" <del...@codethree.com> wrote in message

news:3ecc6c70@newsgroups.borland.com...
Quote
> Yep, I know that. However, I don't want to clutter up the clipboard. Is
> there a more "direct" transfer method?

Other Threads