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 are used to determine whether a drag object is accepted or not by the TDropTarget control. 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:

  Accept:=true;

In order for the Filter to work properly, the assigned string must be formatted similarly to the Filter of the TOpenDialog control. The format is 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