Class Fox::FXFileSelector
In: rdoc-sources/FXFileSelector.rb
Parent: FXPacker

File selection widget

File selection modes

SELECTFILE_ANY:A single file, existing or not (to save to)
SELECTFILE_EXISTING:An existing file (to load)
SELECTFILE_MULTIPLE:Multiple existing files
SELECTFILE_MULTIPLE_ALL:Multiple existing files or directories
SELECTFILE_DIRECTORY:Existing directory

Wildcard matching modes

FILEMATCH_FILE_NAME:No wildcard can ever match "/" (or "\","/" under Windows).
FILEMATCH_NOESCAPE:Backslashes don’t quote special chars ("\" is treated as "\").
FILEMATCH_PERIOD:Leading "." is matched only explicitly (Useful to match hidden files on Unix).
FILEMATCH_LEADING_DIR:Ignore "/…" after a match.
FILEMATCH_CASEFOLD:Compare without regard to case.

Note that under Windows, FILEMATCH_NOESCAPE must be passed.

Message identifiers

ID_FILEFILTER:x
ID_ACCEPT:x
ID_FILELIST:x
ID_DIRECTORY_UP:x
ID_DIRTREE:x
ID_HOME:x
ID_WORK:x
ID_BOOKMARK:x
ID_VISIT:x
ID_NEW:x
ID_DELETE:x
ID_MOVE:x
ID_COPY:x
ID_LINK:x

Methods

Attributes

acceptButton  [R]  The "Accept" button [FXButton]
cancelButton  [R]  The "Cancel" button [FXButton]
currentPattern  [RW]  Current pattern number [Integer]
directory  [RW]  Directory [String]
fileBoxStyle  [RW]  Change file list style [Integer]
filename  [RW]  File name [String]
itemSpace  [RW]  Inter-item spacing (in pixels) [Integer]
matchMode  [RW]  Wildcard matching mode [Integer]
pattern  [RW]  File pattern [String]
selectMode  [RW]  Change file selection mode [Integer]

Public Class methods

Given a pattern of the form "*.gif,*.GIF", return the first extension of the pattern, i.e. "gif" in this example. Returns empty string if it doesn’t work out.

Given filename pattern of the form "GIF Format (*.gif)", returns the pattern only, i.e. "*.gif" in this case. If the parentheses are not found then returns the entire input pattern.

Public Instance methods

Returns an array of the selected file names.

Returns the list of patterns (an Array of Strings).

Get pattern text for given pattern number

Set state of read-only button.

Return true if in read-only mode.

Show read-only button.

Return true if the read-only button is shown.

Change the list of file patterns shown in the file selector. The patterns argument is an array of strings, and each string represents a different file pattern. A pattern consists of an optional name, followed by a pattern in parentheses. For example, this code:

  patterns = [ "*", "*.cpp,*.cc", "*.hpp,*.hh,*.h" ]
  aFileSelector.setPatternList(patterns)

and this code:

  patterns = [ "All Files (*)", "C++ Sources (*.cpp,*.cc)", "C++ Headers (*.hpp,*.hh,*.h)" ]
  aFileSelector.setPatternList(patterns)

will both set the same three patterns, but the former shows no pattern names.

For compatibility with the FOX C++ library API of the same name, setPatternList also accepts a patterns value that is a single string, with each pattern separated by newline characters, e.g.

  patterns = "All Files (*)\nC++ Sources (*.cpp,*.cc)\nC++ Headers (*.hpp,*.hh,*.h)"
  aFileSelector.setPatternList(patterns)

Change pattern text for pattern number

[Validate]