Hi,
I struggle to copy data from one RichViewEdit to another.
procedure TfmPrjMain.bbTxferFromClick(Sender: TObject);
var
ARVComponent : TRichViewEdit;
begin
ARVComponent := RichViewEdit1;
if ARVComponent <> nil then
begin
myEdForm.RichViewEdit1.options := [rvoAutoCopyRVF];
myEdForm.RichViewEdit1.Format;
myEdForm.RichViewEdit1.SelectAll;
myEdForm.RichViewEdit1.CopyDef;
ARVComponent.PasteRVF;
ARVComponent.Format;
end;
end;
Could it be that I am using the trial still as my second RVE just stays with the default text and I don't get the data in.
I would like to know where I misunderstand the RVE operation.
Is there another way to transfer the content?
Bennie
Struggling with clipboard copying
-
- Site Admin
- Posts: 17566
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Site Admin
- Posts: 17566
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Your code works correctly. But RichViewEdit1 must be associated with TRVStyle component.
Place a new TRVStyle component on TfmPrjMain, and assign it to RichViewEdit1.Style (in the Object Inspector).
PS: copying via the Clipboard is not a good idea, because the Clipboard should not be changed unless the user directly calls Copy or Cut command.
Use this code to copy from Src to Dst:
Place a new TRVStyle component on TfmPrjMain, and assign it to RichViewEdit1.Style (in the Object Inspector).
PS: copying via the Clipboard is not a good idea, because the Clipboard should not be changed unless the user directly calls Copy or Cut command.
Use this code to copy from Src to Dst:
Code: Select all
procedure CopyDoc(Src, Dst: TCustomRichViewEdit);
var Stream: TMemoryStream;
begin
Stream := TMemoryStream.Create;
Src.SaveRVFToStream(Stream, False);
Stream.Position := 0;
Dst.LoadRVFFromStream(Stream);
Stream.Free;
Dst.Format;
end;