This class is meant as an emulation of CocoaDialog. last mod: 17-jul-09 sciss
known issues / todo | |
maxSize | only a single file can be selected for opening at the moment |
Note: please use the abstraction layer Dialog if possible!
SwingDialog
is a factory class for displaying file selection dialogs.
SwingDialog.getPaths( <okFunc>, <cancelFunc>, <maxSize = 20> )
Displays an Open File Dialog. If ok is pressed then okFunc
is evaluated with the selected paths passed as an Array of Strings as the first argument. If cancel is pressed then cancelFunc
is evaluated. maxSize
is the maximum number of files which may be selected.
Note: at the moment, only one file is returned. this is a limitation of java.awt.FileDialog
. one could alternatively use javax.swing.JFileChooser
, but that is extremely awfully implemented in Apple's VM.
( SwingDialog.getPaths({ arg paths; paths.do({ arg p; p.postln; }) },{ "cancelled".postln; }); )
SwingDialog.savePanel( <okFunc>, <cancelFunc> )
Displays a Save File Dialog. If ok is pressed then okFunc
is evaluated with the selected path passed as a String as the first argument. If cancel is pressed then cancelFunc
is evaluated.
( SwingDialog.savePanel({ arg path; path.postln; },{ "cancelled".postln; }); )