Copy/paste without using the clipboard

General TRichView support forum. Please post your questions here
Post Reply
martindholmes
Posts: 131
Joined: Mon Aug 29, 2005 12:03 pm

Copy/paste without using the clipboard

Post by martindholmes »

Hi there,

I need to move some data from one TRichViewEdit to another -- actually, I'm inserting the entire contents of one TRVE into the cursor position of the other. The simplest way to do this would be using copy/paste via the clipboard, but I don't want to do that because that will replace the previous contents of the clipboard without the user's permission.

Does anyone have any suggestions for moving data between two TRichViewEdits without using the clipboard?

All help appreciated,
Martin
shmp
Posts: 140
Joined: Sun Aug 28, 2005 10:19 am
Location: Sabah, Malaysia.
Contact:

Post by shmp »

If I am not mistaken, you can insert file from stream. Age have blurred my memory :(

Henry
mamouri
Posts: 63
Joined: Sat Aug 19, 2006 5:06 am

Post by mamouri »

I think you could use this:
var
AStream: TMemoryStream;
begin
AStream := TMemoryStream.Create;
RichViewEdit1.SaveRVFToStream(AStream, True); // Copy the Selection into Stream
AStream.Position:=0;
RichViewEdit2.InsertRVFFromStream(AStream);
RichViewEdit2.Format;
end;
I type the code in editor. may be it need some changes in method names
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

If you need to copy the entire RichViewEdit1, call SaveRVFToStream with the last parameter = False.
To insert in the position of caret, use InsertRVFFromStreamEd. Do not call Format. Format is necessary after LoadRVFFromStream or InsertRVFFromStream, but not needed after InsertRVFFromStreamEd.
Last edited by Sergey Tkachenko on Sun Mar 04, 2007 10:04 am, edited 1 time in total.
martindholmes
Posts: 131
Joined: Mon Aug 29, 2005 12:03 pm

Post by martindholmes »

That's just what I need. Many thanks!

Cheers,
Martin
Post Reply