Vcl.ExtDlgs.TOpenPictureDialog.Filter

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property Filter stored IsFilterStored;

C++

__property Filter = {stored=IsFilterStored, default=0};

Properties

Type Visibility Source Unit Parent
property published
Vcl.ExtDlgs.pas
Vcl.ExtDlgs.hpp
Vcl.ExtDlgs TOpenPictureDialog

Description

Determines the file masks (filters) available in the dialog.

Vcl.ExtDlgs.TOpenPictureDialog.Filter inherits from Vcl.Dialogs.TOpenDialog.Filter. All content below this line refers to Vcl.Dialogs.TOpenDialog.Filter.

Determines the file masks (filters) available in the dialog.

The file-selection dialog includes a drop-down list of file types under the edit box. When the user picks a file type from the list, only files of the selected type are displayed in the dialog.

To configure file masks at design time, click on the ellipsis marks (...) to the right of the Filter property in the Object Inspector. This opens the Filter editor. In the left column of the Filter editor, under Filter Name, type a brief description of each file type that will be available at runtime. In the right column, under Filter, type the file mask corresponding to each description. For example, the description "Text files" might appear to the left of the mask "*.txt", and the description "Pascal source files" might appear to the left of the mask "*.pas". Since the description appears in the drop-down list at runtime, it is often helpful to show the mask explicitly in the description (for example, "Text files (*.txt)").

To create file masks in program code, assign a value to the Filter property that consists of a description and a mask separated by a vertical bar (pipe) character. Do not include spaces around the vertical bar. For example,



OpenDialog1.Filter := 'Text files (*.txt)|*.TXT';



OpenDialog1->Filter = "Text files (*.txt)|*.TXT";



Multiple filters should be separated by vertical bars. For example,



OpenDialog1.Filter := 'Text files (*.txt)|*.TXT|Pascal files (*.pas)|*.PAS';



OpenDialog1->Filter = "Text files (*.txt)|*.TXT|Pascal files (*.pas)|*.PAS";



To include multiple masks in a single filter, separate the masks with semicolons. This works both in the Object Inspector and in program code. For example,



OpenDialog1.Filter := 'Pascal files|*.PAS;*.DPK;*.DPR';



OpenDialog1->Filter = "Pascal files|*.PAS;*.DPK;*.DPR";



If no value is assigned to Filter, the dialog displays all file types.

See Also

Code Examples