The FileFilter object is used to indicate what files on the user's system are shown in the file-browsing dialog box that is displayed when the browseForOpen method of a File object is called. FileFilter instances are passed as a value for the optional typeFilter parameter to the method. If you use a FileFilter instance, extensions and file types that aren't specified in the FileFilter instance are filtered out; that is, they are not available to the user for selection. If no FileFilter object is passed to the method (nil), all files are shown in the dialog box.


You can use FileFilter instances in one of two ways:


    A description with file extensions only

    A description with file extensions and Macintosh file types


The two formats are not interchangeable within a single call to the browse method. You must use one or the other.


Can be created using method new:

Lib.Media.Net.FileFilter.new(description, extension, macType)

Creates a new FileFilter instance.

description - The description string that is visible to users when they select files for uploading.

extension - A list of file extensions that indicate which file formats are visible to users when they select files for uploading.

macType (default = nil) - A list of Macintosh file types that indicate which file types are visible to users when they select files for uploading. If no value is passed, this parameter is set to null. 


Created FileFilter object has properties:

description

The description string for the filter. The description is visible to the user in the dialog box that opens when browseForOpen() is called. The description string contains a string, such as "Images (*.gif, *.jpg, *.png)", that can help instruct the user on what file types can be opened.

extension

A list of file extensions. This list indicates the types of files that you want to show in the file-browsing dialog box. (The list is not visible to the user; the user sees only the value of the description property.) The extension property contains a semicolon-delimited list of file extensions, with a wildcard (*) preceding each extension, as shown in the following string: "*.jpg;*.gif;*.png". 

macType

A list of Macintosh file types. This list indicates the types of files that you want to show in the file-browsing dialog box. (This list itself is not visible to the user; the user sees only the value of the description property.) The macType property contains a semicolon-delimited list of Macintosh file types, as shown in the following string: "JPEG;jp2_;GIFF". 


Examples:


local file = Lib.Media.FileSystem.File.new(nil)

file.browseForOpen("Open Archives", {Lib.Media.Net.FileFilter.new("Archives *.zip;*.rar", "*.zip;*.rar", "zip;rar")}) 

Created with the Personal Edition of HelpNDoc: Free iPhone documentation generator