FMX.ExtCtrls.TDropTarget.Filter

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property Filter: string read FFilter write FFilter;

C++

__property System::UnicodeString Filter = {read=FFilter, write=FFilter};

Properties

Type Visibility Source Unit Parent
property published
FMX.ExtCtrls.pas
FMX.ExtCtrls.hpp
FMX.ExtCtrls TDropTarget

Description

Represents a string of file name filters.

Filter represents a list of file name filters that determine whether a drag object is accepted or not by the TDropTarget control.

Consider the information below while using filters:

  • A drag object is accepted only if the filter indicated by the value of the FilterIndex property matches at least one of the drag object's file names.
  • If the value of the Filter is an empty string, nothing is accepted.
  • To accept drop objects of all types, set the Filter property to an empty string and add the following line to the OnDragOver event handler:
  Operation := TDragOperation.Move;

In order for the Filter to work properly, format the assigned string similar to the Filter of the TOpenDialog control as follows:

'<first filter name>|<first filter value>|<second filter name>|<second filter value>|...|<n-th filter name>|<n-th filter value>'

For example, the next code sample will add filters for text and executable files:

  DropTarget1.Filter := 'Applications (*.exe)|*.EXE|Text files (*.txt)|*.TXT';

See Also