Page 1 of 1

Copy from TRichViewEdit to clipboard

Posted: Fri Oct 12, 2007 4:09 pm
by spike
I load a formated text from a non empty TMemoryStream into my TRichViewEdit then copy data to the clipboard via CopyRTF method but when I check there's nothing in the clipboard. :shock:

Code:

form := TForm.Create(nil);
rich := TRichViewEdit.Create(form);
rich.Name := 'rich1';
rich.Parent := form;
rich.LoadTextFromStream(memoryStream)
rich.CopyRTF;
rich.Free;
form.Free;

I would appreciate a little help.... :(

Posted: Fri Oct 12, 2007 5:55 pm
by Sergey Tkachenko
Only selected fragment is copied.
In addition, TRVStyle is required:

Code: Select all

form := TForm.Create(nil); 
rich := TRichViewEdit.Create(form); 
rich.Name := 'rich1'; 
rich.Parent := form; 
rvstyle := TRVStyle.Create(form);
rich.Style := rvstyle;
memoryStream.Position := 0;
rich.LoadTextFromStream(memoryStream) 
rich.Format;
rich.SelectAll;
rich.CopyRTF; 
form.Free;

Posted: Fri Oct 12, 2007 6:03 pm
by spike
Thanx man

It works beautyfully!!!! :P