SuperCollider CLASSES

Dialog

Shows various system dialogs
Inherits from: Object
Subclasses: QDialog

Description

This class allows to show various system dialogs. *openPanel will show a dialog for selecting a file to open, and *savePanel will show a dialog for selecting or creating a file to save to.

Class Methods

*openPanel (okFunc, cancelFunc, multipleSelection: false)

Shows a dialog for selection of an existing file (or multiple files) to open. It does not do anything with the file, instead it just passes the chosen filenames to the given result handler.

Arguments:

okFunc

An object to be evaluated when OK is pressed. As argument, either a single filename is passed as a String, or an Array of Strings for multiple selected items is passed, depending on the multipleSelection argument. The paths will always be absolute paths.

cancelFunc

An object to be evaluated when Cancel is pressed.

multipleSelection

A Boolean indicating whether multiple files can be selected.

Discussion:

Example:

(
Dialog.openPanel({ arg path;
    path.postln;
},{
    "cancelled".postln;
});
)

*savePanel (okFunc, cancelFunc)

Shows a dialog for selecting or creating a file to save to. It does not do anything with the selected file, and does not create any file; instead it just passes the chosen filename to the given result handler.

Arguments:

okFunc

An object to be evaluated when OK is pressed. The chosen filename (as an absolute path) is passed as a String as argument. If the file already exists, the user will be asked to confirm.

cancelFunc

An object to be evaluated when Cancel is pressed.

Discussion:

Example:

(
Dialog.savePanel({ arg path;
    path.postln;
},{
    "cancelled".postln;
});
)

*getPaths (okFunc, cancelFunc, allowsMultiple: true)

From extension in /usr/local/share/SuperCollider/SCClassLibrary/Common/GUI/backwardsCompatibility/deprecated-3.7.sc
NOTE: Deprecated. Use *openPanel instead.

Implements the same functionality as *openPanel, only the last argument is named differently and defaults to true.

Inherited class methods

Instance Methods

Inherited instance methods