hiGetExistingDirectory
hiGetExistingDirectory(
[ ?workingDir t_workingDir ]
[ ?dirOnly g_dirOnly ]
[ ?dialogName s_dialogName ]
[ ?defaultValue t_defaultValue ]
[ ?callback t_callback ]
[ ?userData s_userData ]
[ ?caption t_caption ]
[ ?location l_location ]
[ ?modal g_modal ]
)
=> l_userSelection / nil
Description
Calls hiDisplayFileDialogBox with the mode set to ’dirOnly. If the ?dirOnly argument is nil, calls hiDisplayFileDialogBox with the mode set to ’directory. Use this function to ask the user to select a directory.
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).
|
|
?dirOnly g_dirOnly
|
|
|
t or nil. If you specify t, the file dialog displays only directories, if you specify nil, the file dialog displays both directories and files. The default value is t.
|
|
?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 the directory 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 OK, Apply, and Cancel buttons.
The third argument, l_userData, is passed only if you specify the s_userData argument to this function.
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 Open a Directory.
|
|
?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.
|
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 selection is either in t_workingDir or in a directory ascending or descending from t_workingDir. Otherwise, dir is an absolute path.
file is an empty string.
|
|
nil
|
Returns nil if the file dialog box is modeless, or if the file dialog box is modal and has been canceled.
|
Related Topics
File Selection Dialog Box Functions
hiFileDialogSelection
hiFileDialogSetSelection
hiFileDialogDone
hiGetExistingFiles
hiGetAnyFile
hiGetExistingDirectory
Return to top