RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TFileListBox.Mask Property

Limits which files are displayed in the file list box.

Pascal
property Mask: string;
C++
__property AnsiString Mask;

Set Mask to a regular expression to limit the list box to files that match the mask. The value of the mask is a file name that may include wildcards. The asterisk (*) is a wildcard which matches any number of arbitrary characters. The question mark (?) is a wildcard which matches a single arbitrary character. The file mask *.* displays all files, which is the default value. 

To specify multiple file masks, separate the file mask specifications with semicolons. For example, *.DLL;*.EXE. 

If the form includes a TFilterComboBox object, set the FileList property of the filter combo box to have the Mask property updated automatically when the Mask property of the filter combo box changes.  

C++ Examples: 

 

/*
This example uses a filter combo box and a file list box on
a form. When the user selects a filter in the filter combo
box, the file list box displays only files which match the
selected mask:
*/
void __fastcall TForm1::FilterComboBox1Change(TObject *Sender)
{
  FileListBox1->Mask = FilterComboBox1->Mask;
}

void __fastcall TForm1::FormCreate(TObject *Sender)
{
  FilterComboBox1->Filter = "All files (*.*)|*.*| Executable files (*.exe)|*.exe";
}

 

Delphi Examples: 

{
This example uses a filter combo box and a file list box on
a form. When the user selects a filter in the filter combo
box, the file list box displays only files which match the
selected mask:
} 
procedure TForm1.FilterComboBox1Change(Sender: TObject);
begin
  FileListBox1.Mask := FilterComboBox1.Mask;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  FilterComboBox1.Filter := 'All files (*.*)|*.*| Pascal files (*.pas)|*.pas';
end;

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!