rvico TRichView Reference | TRichViewEdit

TCustomRichViewEdit.AcceptDragDropFormats, AcceptPasteFormats

Top  Previous  Next

AcceptDragDropFormats lists formats that can be accepted when dropping data in TRichViewEdit.

AcceptPasteFormats lists formats that can be accepted when pasting in TRichViewEdit.

property AcceptDragDropFormats: TRVDragDropFormats;

property AcceptPasteFormats: TRVDragDropFormats;

 

type

  TRVDragDropFormat = (

    rvddRVF, rvddRTF, rvddText, rvddUnicodeText,

    rvddBitmap, rvddMetafile, rvddURL, rvddFiles, rvddHTML);

  TRVDragDropFormats = set of TRVDragDropFormat;

(introduced in v1.8 & v14)

Value

D&D Format

Meaning

rvddRVF

'RichView Format'

RichView Format

rvddRTF

'Rich Text Format'

RTF

rvddText

CF_TEXT

Plain ANSI text

rvddUnicodeText

CF_UNICODETEXT

Plain Unicode text

rvddBitmap

CF_DIB or CF_BITMAP

Bitmap

rvddMetafile

CF_ENHMETAFILE

Metafile

rvddURL

'UniformResourceLocator'

URL. If available, URL caption is read from CFSTR_FILEDESCRIPTOR format (otherwise caption = target).

OnReadHyperlink event occurs with DocFormat=rvlfURL. If this event is not processed, URL is inserted as a plain text.

rvddFiles

CF_HDROP

By default, RichViewEdit inserts:

graphic files,
*.RTF (only drag&drop),
*.RVF (only drag&drop),
*.TXT (only drag&drop).

You can modify the default processing in OnDropFiles event (only drag&drop).

rvddHTML


Reserved for future use

Example (processing OnReadHyperlink with rvddURL support)

// OnReadHyperlink

procedure TMyForm.MyRichViewEditReadHyperlink(Sender: TCustomRichView;

  const Target, Extras: String; DocFormat: TRVLoadFormat;

  var StyleNo: Integer; var ItemTag: TRVTagvar ItemName: TRVRawByteString);

begin

  if DocFormat=rvlfURL then

    StyleNo := GetHyperlinkStyleNo(Sender);

  ItemTag := Target;

end;

 

// This function returns the index of a text style having all properties

// like the current style, but hypertext, blue, underlined.

// If this style does not exist, it is added.

function TMyForm.GetHyperlinkStyleNo(rve: TCustomRichViewEdit): Integer;

var TextStyle: TFontInfo;

begin

  Result := rve.CurTextStyleNo;

  TextStyle := TFontInfo.Create(nil);

  try

    TextStyle.Assign(rve.Style.TextStyles[Result]);

    TextStyle.Jump := True;

    TextStyle.Color := clBlue;

    TextStyle.Style := TextStyle.Style+[fsUnderline];

    Result := rve.Style.FindTextStyle(TextStyle);

  finally

    TextStyle.Free;

  end;

end;

Default value:

[rvddRVF, rvddRTF, rvddText, rvddUnicodeText, rvddBitmap, rvddMetafile, rvddFiles] (all except for rvddURL)

See also:

Paste;
CanPaste;
Drag&Drop.


TRichView © trichview.com