rvico TRichView Reference | Overview

Drag&Drop in TRichView

Top  Previous  Next

You can drag data from TRichView or TRichViewEdit. You can drop data to TRichViewEdit.

Drag&drop is possible not only inside the same editor, but between different controls and even between different applications.

For example, you can drop files from Windows Explorer, hyperlinks, text and images from Internet Explorer or Word.

Drag&drop feature requires Delphi 3 or newer, or C++Builder 3 or newer (it is disabled for Delphi 2 and C++Builder 1).

Dragging from TRichView (or TRichViewEdit)

TRichView provides data in the following formats:

RichView Format ('RichView Format')

RTF ('Rich Text Format')

ANSI text (CF_TEXT)

Unicode text (CF_UNICODETEXT)

bitmap (CF_BITMAP), if TBitmap picture is selected

metafile (CF_ENHMETAFILE), if TMetafile picture is selected.

You can disallow dragging from the given TRichView by including rvoDisallowDrag in the Options property.

TRichView cannot initialize dragging of inserted controls. If you want to drag them, use BeginOleDrag method.

Dragging to TRichViewEdit

AcceptDragDropFormat lists formats that can be accepted.

By default all formats are accepted except for URL (because it requires processing in OnReadHyperlink)

Dropped object can contain data in multiple formats. The priority is: RVF, then RTF, then URL, then text, then bitmap, then metafile, then files.

If the current text style is Unicode, Unicode text format has higher priority than ANSI text format, and vice versa.

The following events may occur:

OnReadHyperlink;

OnDropFile;

OnDropFiles.

You can customize drag&drop process using the following low level events:

OnOleDragEnter;

OnOleDragOver;

OnOleDragLeave;

OnOleDrop.

See also...

Clipboard


TRichView © trichview.com