SuperCollider CLASSES

FileDialog

Operating system interface for Open file, save file, select directory dialogs
Inherits from: QObject : Object
Subclasses: QFileDialog

Description

This is the interface for your standard operating system modal file dialogs to open files, save files and select directories.

See also Dialog which makes it a bit simpler without the need to set fileMode and acceptMode manually.

At the moment selecting a directory is only possible with FileDialog.

Class Methods

*new (okFunc, cancelFunc, fileMode, acceptMode, stripResult: false)

Open a modal dialog

Arguments:

okFunc

handler function for: user selected a file and clicked ok. Argument to the function is either a single path, an array of paths, or multiple paths passed in as separate arguments. This depends on what fileMode and stripResult were specified.

cancelFunc

handler function for: user cancelled

fileMode

Integer

Determines the type of dialog.

  • 0 QFileDialog AnyFile The name of a file, whether it exists or not.
  • 1 QFileDialog ExistingFile The name of a single existing file.
  • 2 QFileDialog Directory The name of a directory. Both files and directories are displayed.
  • 3 QFileDialog ExistingFiles The names of zero or more existing files.

0 or 3 implies that the user can type in a new file name.

acceptMode

Integer This determines what the accept button says: "Open" or "Save"

  • 0 QFileDialog AcceptOpen
  • 1 QFileDialog AcceptSave
stripResult

If selecting multiple files (using fileMode 3) then you have the choice of having your okFunc called with a list or with each of the paths as separate items.

If you want to select only one item then use stripResult = true so that your okFunc will be passed the item instead of a list.

  • true: okFunc(path1, path2, path3)
  • false: okFunc(paths)

Returns:

a FileDialog

*qtClass

private

Inherited class methods

Instance Methods

Inherited instance methods

Examples

FileDialog({ |path|

}, {

});