hiGetAnyFile
hiGetAnyFile(
[ ?workingDir t_workingDir ]
[ ?filter t_filter ]
[ ?dialogName s_dialogName ]
[ ?defaultValue t_defaultValue ]
[ ?callback t_callback ]
[ ?userData s_userData ]
[ ?caption t_caption ]
[ ?location l_location ]
[ ?modal g_modal ]
[ ?acceptMode s_acceptMode ]
[ ?confirmOverwrite g_confirmOverwrite ]
)
=> l_userSelection / nil
Description
Calls hiDisplayFileDialogBox with the mode set to ’anyFile. Use this function to prompt the user to specify the name of a file to open or save.
This function is provided as a quick and convenient way to display a file dialog by specifying only the working directory; default values for the rest of the arguments are provided.
Arguments
|
?workingDir t_workingDir
|
|
|
Text string specifying the working directory. This is the directory that appears in the Look in field.
The default value of this argument is "." (the current working directory).
|
|
?filter t_filter
|
Text string specifying the filters that can be used in the File type field. For example:
"Images (*.png *.xpm *.jpg)"
If you want to specify multiple filters, separate them with two semicolons. For example:
"Images (*.png *.xpm *.jpg);;Text Files (*.txt);;XML Files (*.xml)"
If you do not specify a filter, the default is “All Files (*)”.
|
|
?dialogName s_dialogName
|
|
|
SKILL symbol that is the handle to the file dialog box. When the dialog box is destroyed (that is, when the hiFileDialogDone command is executed), this symbol is reset to nil. Do not reference a deleted file dialog box; it can cause undefined behavior.
|
|
?defaultValue t_defaultValue
|
|
|
Text string specifying a file that is selected by default.
|
|
?callback t_callback
|
|
|
Text string specifying the SKILL function to be called when the user makes a selection in the dialog box.
The callback function is passed either two or three arguments. The first argument is &_dialog, the handle to the file dialog box.
The second argument is s_event, indicating which button the user clicked after making a selection. s_event is one of ’done, ’apply, or ’cancel, corresponding to the Save, Apply, and Cancel buttons.
The third argument, l_userData, is passed only if you specify the s_userData argument to this function.
Note: If the dialog box is modeless, you must specify a callback to handle the user selection, as this function returns nil immediately after the dialog box is displayed.
|
|
?userData s_userData
|
|
|
Symbol specifying user data for the callback. If you specify this argument, an additional argument, userData, is passed to the callback function. Otherwise, the callback is passed only two arguments.
|
|
?caption t_caption
|
|
|
Text string that gets displayed in the file dialog box banner. The default caption is Specify a File.
|
|
?location l_location
|
|
|
The location of the dialog box on the screen, specified as a list of the x and y coordinates of the upper left corner of the box:
list(x-coordinate y-coordinate)
If this argument is not specified or if it is specified incorrectly, then the default location set by hiSetDBoxDefaultLocation is used. If the default location has not been set, then the toolkit that implements the dialog box determines the location (usually the center of the screen).
|
|
?modal g_modal
|
non-nil or nil. Specify any non-nil value if you want the dialog box to be modal (blocking) or nil if you want the dialog box to be modeless (non-blocking).
If the dialog box is modal, calls to hiDisplayFileDialog do not return until the user clicks one of the buttons on the dialog box. In this case, you can either handle the user selection immediately, or in a callback as you would with a modeless dialog box.
If the dialog box is modeless, calls to hiDisplayFileDialog return a value of nil immediately after the dialog is displayed. Therefore, you must specify a callback to handle the user selection.
|
|
?acceptMode s_acceptMode
|
|
|
One of the following symbols: ’open or ’save, that specify the button to display on the dialog box. Specify ’open if you are creating a dialog for opening files (an Open button appears on the dialog) or ’save if you are creating a dialog for saving files (Save button appears on the dialog).
Default value: ’save
|
|
?confirmOverwrite g_confirmOverwrite
|
|
|
Set this optional argument to nil if you do not want to display a dialog box that asks for a file overwrite confirmation when an existing file is selected , and argument s_mode equals 'anyFile.
Set it to t to display the overwrite confirmation dialog box but this only applies when the argument s_mode equals 'anyFile.
Default value: t
|
Values Returned
|
l_userSelection
|
Returns l_userSelection if the file dialog box is modal and the user makes a selection.
l_userSelection is a list of two elements, each of which is a string:
("dir" "file")
dir is a path relative to t_workingDir if the selected file is either in t_workingDir or in a directory ascending or descending from t_workingDir. Otherwise, dir is an absolute path.
file is the file that was selected.
|
|
nil
|
Returns nil if the file dialog box is modeless, or if the file dialog box is modal and has been canceled.
|
Example
(edit (buildString (hiGetAnyFile) "/"))
hiGetAnyFile(?acceptMode ’open)
Related Topics
File Selection Dialog Box Functions
hiFileDialogSelection
hiFileDialogSetSelection
hiFileDialogDone
hiGetExistingFiles
hiGetExistingDirectory
Return to top