RichView Clipboard Functions Overview
|Top Previous Next|
TCustomRichView and its descendants can copy information to the Clipboard as plain (ANSI and Unicode) text, image, RTF and RVF, and your own custom formats.
RichViewEdit can paste information from the Clipboard as text (ANSI and Unicode), image, RTF, and RVF (and your own formats).
The main method for copying to the Clipboard is CopyDef. It can copy selection in one or more formats.
This method copies data in formats specified in RichView.Options:
CopyDef is called automatically when the user presses Ctrl + Insert or Ctrl + C .
You can also use methods for copying:
▪Copy – copies selection to the Clipboard in all formats;
▪CopyTextA – copies the selection as ANSI text;
▪CopyTextW – copies selection as Unicode text
▪CopyImage – if there is a selected image, this method copies it to the Clipboard;
▪CopyRVF – copies selection in RVF format. This format has name 'RichView Format' and consist of two parts: <Size of RVF><RVF> where <Size of RVF> is 4-byte integer value (number of bytes in <RVF>), <RVF> is RVF data (see: About RVF, RVF Specification)
▪CopyRTF – copies selection as RTF (Rich Text Format).
SelectionExists method answers to the question "does the selection contain some data (not empty)?"
OnCopy event allows copying in your own formats.
TRichView cannot paste. All these methods are methods of TRichViewEdit.
▪PasteBitmap – pastes bitmap from the Clipboard, if available;
▪PasteMetafile – pastes metafile picture from the Clipboard, if available;
▪PasteGraphicFile – pastes graphic file(s) the Clipboard, if available;
▪PasteText – pastes text from the Clipboard, if available;
▪PasteRVF – pastes RVF from the Clipboard, if available;
▪PasteRTF – pastes RTF from the Clipboard, if available;
▪PasteURL – pastes URL from the Clipboard, if available;
▪Paste – tries to paste as an RVF; if cannot – as an RTF, if cannot – as an URL, if cannot – as a text; if cannot – as graphic file(s), if cannot – as a bitmap; if cannot – as a metafile.AcceptPasteFormats property is taken into account. This method is called automatically when user press Ctrl + V or Shift + Insert .
Testing is the Clipboard has the specific format:
▪CanPaste – "does the Clipboard contain any format what can be pasted in RichViewEdit?"
▪CanPasteRVF – "does the Clipboard contain RVF?"
▪CanPasteRTF – "does the Clipboard contain RTF?"
OnPaste event allows to override the default pasting procedure. For example, you can paste data in different format, or you can allow pasting only some specific formats (for example, only a plain text).
RichView processes WM_COPY message, RichViewEdit also processes WM_PASTE, WM_CUT, EM_CANPASTE.
TRichView © trichview.com