Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

FileSelector Class Reference

List of all members.

Detailed Description

The file selector opens up an OS-specific file selection dialog for saving or loading a file or files.

For example, this puts up a file selector for a set of image files:

 char [] [] selectImages ()
     with (new FileSelector (false))
         multiSelect = true;
         addFilter ("All Files", "*");
         addFilter ("Image Files", "*.png;*.jpg;*.jpeg");
         return run ();

Public Member Functions

 this (bit save)
 Set save mode.

 this (Control parent, bit save)
 Set the parent and save mode.

void addFilter (char[] desc, char[] pattern)
 Call addFilter (desc, pattern, false).

void addFilter (char[] desc, char[] pattern, bit isdefault)
 Add a file filter.

void customFilter (char[] desc)
 Call customFilter (desc, null, false).

void customFilter (char[] desc, char[] pattern)
 Call customFilter (desc, pattern, false).

void customFilter (char[] desc, char[] pattern, bit isdefault)
 Set the custom filter.

char[][] run ()
 Open up the file selector and start selecting.

char[] runSingle ()
 Open the file selector and start selecting.

Public Attributes

Control parent
 The control spawning this selector or null if none; this has no effect to my knowledge.

Filter[] filters
 The list of filters registered with addFilter.

int defaultFilter
 The default filter index, 0 for the custom filter, or an index into filters plus one.

Filter custom
 The custom filter that holds what filter the user enters into the selection editor.

char[] title
 The text to use in the title bar of the selector, or null for some default.

char[] filename
 The default filename to insert in the edit box.

bit multiSelect = false
 Whether this is a multiple-file selector.

bit createPrompt = false
 If the user selects a file that doesn't exist, whether to give an "Are you sure?" message.

bit fileMustExist = true
 Display a warning if the user selects a nonexistent file.

bit showReadOnly = false
 Show a read-only checkbox.

bit overwritePrompt = false
 If this is a save dialog, ask whether the user wants to overwrite this.

bit pathMustExist = true
 Display a warning if the user selects a nonexistent path.

bit save = false
 Save mode if true, open mode if false.

Member Function Documentation

void FileSelector.addFilter chardesc  [],
charpattern  [],
bit  isdefault

Add a file filter.

The desc is some description (such as "Text Strings") while the pattern is a set of semicolon-separated wildcard filters (such as "*.txt;*.doc;*.bak") that are matched case-independent. If isdefault is true, this is made the default filter on startup.

void FileSelector.customFilter chardesc  [],
charpattern  [],
bit  isdefault

Set the custom filter.

This is the filter the user writes to when he inputs some wildcard in the selection editor.

See also:

char [][]  ) 

Open up the file selector and start selecting.

If the user hit cancel or some benign error occured, this returns a null array. Otherwise this returns a list of selected files with full paths.

char [] FileSelector.runSingle  ) 

Open the file selector and start selecting.

Returns null if it was aborted, or the name of the first file if it was successful.

The documentation for this class was generated from the following file:
Generated on Thu Sep 4 13:12:51 2003 for dig by doxygen 1.3.2