Class TFileFilterList
Unit
CastleFileFilters
Declaration
type TFileFilterList = class(specialize TObjectList<TFileFilter>)
Description
This item has no description.
Hierarchy
- TObject
- TList
- TObjectList
- TFileFilterList
Overview
Methods
|
constructor Create(AFreeObjects: Boolean); |
|
procedure AddFilter(const Name: string; const Patterns: array of string); |
|
procedure AddFiltersFromString(const FiltersStr: string); |
|
function Matches(const Url: String): Boolean; overload; |
|
class function Matches(const FiltersStr, Url: String): Boolean; overload; |
|
function AllExtensions: String; |
|
procedure LclFmxFilters( out OutFilter: string; out OutFilterIndex: Integer; const AllFields: Boolean = true); |
|
class procedure LclFmxFiltersFromString(const FileFilters: string; out OutFilter: string; out OutFilterIndex: Integer; const AllFields: Boolean = true); |
Properties
|
property DefaultFilter: Integer
read FDefaultFilter write FDefaultFilter default 0; |
Description
Methods
|
constructor Create(AFreeObjects: Boolean); |
This item has no description. |
|
procedure AddFilter(const Name: string; const Patterns: array of string); |
Add one file filter, selectable by user.
Parameters
- Name
- Is a name displayed for for user.
- Patterns
- Each string in Patterns is a pattern using * and ? matching characters.
|
|
procedure AddFiltersFromString(const FiltersStr: string); |
An easy way to add multiple filters encoded in a single string. Filters are separated by '|' (bar character). Each filter has a name, separated from patterns list also by '|'. If filter name starts with '*', it's set as a default filter. Patterns are separated by ';' (semicolon character).
As you can see, this prevents some special characters from appearing in names and patterns. For maximum flexibility, don't use this function, use AddFilter.
For example All files (*)|*|All images (*.png;*.jpg)|*.png;*.jpg|PNG images (*.png)|*.png
Not finished pairs of name + pattern at the end of the string are ignored. In particular, empty string is unfinished (actually, it contains an empty Name, and is unfinished because there is no |, so no matching Pattern) so empty string causes no filters to be added.
|
|
function Matches(const Url: String): Boolean; overload; |
One of the filtes (excluding "catch all" filters) matches given URL. This excludes masks like "*" and "*.*" (the latter should not really be used, because it will not match all files on Unix).
|
|
class function Matches(const FiltersStr, Url: String): Boolean; overload; |
Whether the filters described in FiltersStr (like for AddFiltersFromString) match the given URL.
|
|
function AllExtensions: String; |
Writes all recognized extensions (without * and *.*) separated by semicolon.
|
|
procedure LclFmxFilters( out OutFilter: string; out OutFilterIndex: Integer; const AllFields: Boolean = true); |
Convert file filters into LCL or FMX Dialog.Filter, Dialog.FilterIndex. When AllFields is false, then filters starting with "All " in the name, like "All files", "All images", are not included in the output.
|
|
class procedure LclFmxFiltersFromString(const FileFilters: string; out OutFilter: string; out OutFilterIndex: Integer; const AllFields: Boolean = true); |
Convert file filters into LCL or FMX Dialog.Filter, Dialog.FilterIndex. The filters are provided here just like for AddFiltersFromString. Effectively we convert one String encoding of filters (as for CGE AddFiltersFromString) into very similar encoding of filters suitable for LCL or FMX.
|
Properties
|
property DefaultFilter: Integer
read FDefaultFilter write FDefaultFilter default 0; |
Index of default filter, selected by default for user when using this filters list.
|
Generated by PasDoc 0.16.0-snapshot.