Class Fox::FXFileDialog
In: rdoc-sources/FXFileDialog.rb
Parent: FXDialogBox

File selection dialog

Each pattern in the patternList comprises an optional name, followed by a pattern in parentheses. The patterns are separated by newlines. For example,

 fileDialog.patternList = ["*",
                           "*.cpp,*.cc",
                           "*.hpp,*.hh,*.h"
                          ]

and

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

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

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.

Methods

Attributes

currentPattern  [RW]  Current pattern number [Integer]
directory  [RW]  Directory [String]
fileBoxStyle  [RW]  File list style [Integer]
filename  [RW]  File name [String]
filenames  [R]  List of selected filenames [Array]
itemSpace  [RW]  Inter-item spacing (in pixels) [Integer]
matchMode  [RW]  Wildcard matching mode [Integer]
pattern  [RW]  File pattern [String]
selectMode  [RW]  File selection mode [Integer]

Public Class methods

Display a dialog box that allows the user to select a directory. Returns the directory name (a String).

Parameters:

owner:the owner window for the dialog box [FXWindow]
caption:the caption for the dialog box [String]
path:the initial directory path [String]

Display a dialog box that allows the user to select a single existing file name for opening. Returns the selected file name (a String).

Parameters:

owner:the owner window for the dialog box [FXWindow]
caption:the caption for the dialog box [String]
path:the initial filename [String]
patterns:the pattern list [String]
initial:the initial pattern to be used (an index into the pattern list) [Integer]

Display a dialog box that allows the user to select multiple existing file names for opening. Returns an array of the selected file names (an array of strings).

Parameters:

owner:the owner window for the dialog box [FXWindow]
caption:the caption for the dialog box [String]
path:the initial filename [String]
patterns:the pattern list [String]
initial:the initial pattern to be used (an index into the pattern list) [Integer]

Display a dialog box that allows the user to select an existing file name, or enter a new file name, for saving. Returns the save file name (a String).

Parameters:

owner:the owner window for the dialog box [FXWindow]
caption:the caption for the dialog box [String]
path:the initial filename [String]
patterns:the pattern list [String]
initial:the initial pattern to be used (an index into the pattern list) [Integer]

Public Instance methods

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

Get pattern text for given pattern number

Set initial state of read-only button, where state is either true or false

Return true if read-only

Return true if read-only button is shown

Change the list of file patterns shown in the file dialog. 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

Set visibility of the read-only button, where shown is either true or false

[Validate]