1

I work with Delphi 2009 on a 64-bit Windows 8 computer and I found that TDBRichEdit and TRichEdit (containing rich text) exhibit a strange and unexpected behaviour when, for instance, I do:

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

Surprisingly, this process appends a new line (a paragraph mark + formatting codes) to the content of RichEdit2.

If, using OLE Automation, I do

RichEdit1.SelectAll;    
RichEdit1.CopyToClipboard;    
WordDoc.Content.Paste;

... do something with Word...

WordDoc.Content.Paste;    
RichEdit2.PasteFromClipboard;

then two lines (a paragraph mark + a paragraph mark + formating codes) are appended to the content of RichEdit2.

Why does this happen? Is it a bug of some sort?

gtro
  • 65
  • 6
  • 1
    I don't understand what being a wrapper for the OS control has to do with it being a bug. If the control *weren't* a wrapper, wouldn't you still think this behavior was a bug? – Rob Kennedy Jul 12 '13 at 18:43
  • 1
    I think that's just how the rich edit control behaves. – David Heffernan Jul 12 '13 at 20:13
  • Did you try this with the mother of all RichEdit apps: [WordPad](http://en.wikipedia.org/wiki/WordPad)? What were the results? – Jeroen Wiert Pluimers Jul 12 '13 at 21:12
  • David is right. the content of a RichEdit is comprised of Lines (a TString type), each of which consists of some text followed by a carriage return (#13). There is therefore no surprise if the display of the RichEdit shows a new line at the bottom of the display (two if the Copy/Paste operation is repeated twice). In the context of my application, this is garbage though normal behaviour for the component. – gtro Jul 13 '13 at 16:13

0 Answers0