rvico TRichView Reference | TRichViewEdit

TCustomRichViewEdit.AcceptDragDropFormats

Top  Previous  Next

Lists formats that can be accepted when dropping data in TRichViewEdit.

property AcceptDragDropFormats: TRVDragDropFormats

 

type

  TRVDragDropFormat = (

    rvddRVF, rvddRTF, rvddText, rvddUnicodeText,

    rvddBitmap, rvddMetafile, rvddURL, rvddFiles);

  TRVDragDropFormats = set of TRVDragDropFormat;

(introduced in v1.8)

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,
*.RVF,
*.TXT.

You can modify the default processing in OnDropFiles event.

Example (processing OnReadHyperlink with rvddURL support)

// OnReadHyperlink. This code assumes rvoTagsArePChars is in

// MyRichViewEdit.Options

procedure TMyForm.MyRichViewEditReadHyperlink(Sender: TCustomRichView;

  const Target, Extras: String; DocFormat: TRVLoadFormat; var StyleNo,

  ItemTag: Integer; var ItemName: String);

begin

  if DocFormat=rvlfURL then

    StyleNo := GetHyperlinkStyleNo(Sender);

  ItemTag := Integer(StrNew(PChar(Target)));

end;

 

// This function returns index of 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.TextStyles.FindSuchStyle(

      Result, TextStyle, RVAllFontInfoProperties);

    if Result<0 then

    begin

      rve.Style.TextStyles.Add;

      Result := rve.Style.TextStyles.Count-1;

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

      rve.Style.TextStyles[Result].Standard := False;

    end;

  finally

    TextStyle.Free;

  end;

end;

Default value:

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

See also:

Drag&Drop.


RichView © Sergey Tkachenko