We have a generic copy-and-paste mechanism in our system. It has been working great except when we copy and paste between 2 TRichViewEdit components.
If I copy (Ctrl+C) from any source, such as MS-Word, Notepad, web page, etc. and paste (Ctrl+V) into a TRichViewEdit component, everything works 100%. The same goes for the other way - if I copy from a TRichViewEdit component into MS-Word or Notepad, everything also works great.
The problem only occurs when I copy-and-paste between 2 TRichViewEdit components. It does copy the original text but it adds a bunch of funny characters to the end. E.g.
Copy Source: Sore Back
Pate Destination: Sore Back??orrection
We did implement a workaround but I would prefer that our generic copy-and-paste works everywhere.
Our generic paste function:
procedure TfrmMain.act02EditPasteExecute(Sender : TObject);
begin
if Assigned(FFocusControl) then
SendMessage(FFocusControl.Handle , WM_PASTE , 0 , 0);
end;
A workaround (that we do not like):
procedure TfrmMain.act02EditPasteExecute(Sender : TObject);
begin
if Assigned(FFocusControl) then
begin
if FFocusControl is TRichViewEdit then
(FFocusControl as TRichViewEdit).InsertText(Clipboard.AsText)
else
SendMessage(FFocusControl.Handle , WM_PASTE , 0 , 0);
end;
end;
Please can you help with resolving this issue.
Many thanks,
Funny characters when copying between TRichViewEdit components
-
- Posts: 5
- Joined: Wed Jul 08, 2020 10:09 am
-
- Site Admin
- Posts: 17555
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Funny characters when copying between TRichViewEdit components
Please tell me
1) TRichView version
2) Delphi version
3) Value of Options property of the source editor
4) Value of AcceptPasteFormats of the destination editor
1) TRichView version
2) Delphi version
3) Value of Options property of the source editor
4) Value of AcceptPasteFormats of the destination editor
-
- Posts: 5
- Joined: Wed Jul 08, 2020 10:09 am
Re: Funny characters when copying between TRichViewEdit components
Here are the details:
1. v18.4
2. Delphi 2010
3. [rvoScrollToEnd,rvoShowPageBreaks,rvoAutoCopyUnicodeText,rvoAutoCopyRVF,rvoAutoCopyImage,rvoAutoCopyRTF,rvoFormatInvalidate,rvoDblClickSelectsWord,rvoRClickDeselects,rvoShowItemHints,rvoFastFormatting]
4. [rvddRVF,rvddRTF,rvddText,rvddUnicodeText,rvddBitmap,rvddMetafile,rvddFiles,rvddHTML]
1. v18.4
2. Delphi 2010
3. [rvoScrollToEnd,rvoShowPageBreaks,rvoAutoCopyUnicodeText,rvoAutoCopyRVF,rvoAutoCopyImage,rvoAutoCopyRTF,rvoFormatInvalidate,rvoDblClickSelectsWord,rvoRClickDeselects,rvoShowItemHints,rvoFastFormatting]
4. [rvddRVF,rvddRTF,rvddText,rvddUnicodeText,rvddBitmap,rvddMetafile,rvddFiles,rvddHTML]
-
- Site Admin
- Posts: 17555
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Funny characters when copying between TRichViewEdit components
Very strange.
Can you give me step-by-step instructions how to reproduce it? May be with a simple sample project.
Can you give me step-by-step instructions how to reproduce it? May be with a simple sample project.
-
- Posts: 5
- Joined: Wed Jul 08, 2020 10:09 am
Re: Funny characters when copying between TRichViewEdit components
Step-by-step instructions are fairly easy. We have a form with a TRichViewEdit component on. We can open multiple instances of the form. You can use the form to insert data into the DB, view data or edit data. We open an instance of the form in "edit" state and another instance in "insert" state. You then select data from the "edit" form and press ctrl+c, you go to the "insert" form and paste by using ctrl+v. Doing it like this adds the funny characters to the text on the "insert" form. If I paste the same data into Word or notepad, everything is fine and no funny characters appear.
I've tried to do a small sample project but we have so much functionality in base classes and templates that I was not able to do it.
I've tried to do a small sample project but we have so much functionality in base classes and templates that I was not able to do it.
-
- Site Admin
- Posts: 17555
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Funny characters when copying between TRichViewEdit components
Copying-pasting between two RichViewEdits must be in RVF format.
But I copy-pasted thousands times while testing the editor, and never seen a result like this.
Maybe you have some copy in OnCopy or OnPaste events?
Is it possible to reproduce it on TRichView demo projects?
But I copy-pasted thousands times while testing the editor, and never seen a result like this.
Maybe you have some copy in OnCopy or OnPaste events?
Is it possible to reproduce it on TRichView demo projects?