<< Click to display table of contents >> TCustomRichViewEdit.OnPaste |
Allows to paste data from the Clipboard in custom formats.
type
TRVPasteEvent =
procedure (Sender: TCustomRichViewEdit;
var DoDefault: Boolean) of object;
property OnPaste: TRVPasteEvent;
(introduced in version 1.3)
Occurs before any data are pasted in editor (Paste method, or Ctrl + V ( Command + V on macOS) / Shift + Insert ).
You can insert data in your own format here and/or forbid default pasting procedure (set DoDefault to False).
Note: see standard priorities of formats for pasting in Paste method.
Example (allowing to paste only one line of plain text):
procedure TMyForm.MyRichViewEditPaste(Sender: TCustomRichViewEdit;
var DoDefault: Boolean);
var s: String;
begin
s := Clipboard.AsText;
if (Pos(#10,s)=0) and (Pos(#13,s)=0) then
MyRichViewEdit.InsertText(s,False);
DoDefault := False;
end;
See also: