All Manuals > CAPI Reference Manual > 1 CAPI Reference Entries

NextPrevUpTopContentsIndex

prompt-for-directory

Function
Summary

Displays a dialog prompting the user for a directory.

Package

capi

Signature
prompt-for-directory message &key if-does-not-exist pathname file-package-is-directory pane-args popup-args owner continuation => result, successp
Arguments

message

A string.

if-does-not-exist

One of :ok , :prompt or :error .

pathname

A pathname, or nil .

file-package-is-directory

A generalized boolean.

pane-args

Arguments to pass to the pane.

popup-args

Arguments to pass to the confirmer.

owner

An owner window.

continuation

A function or nil .

Values

result

A directory pathname, or nil .

successp

A boolean.

Description

The function prompt-for-directory prompts the user for a directory pathname using a dialog box. Like all the prompters, prompt-for-directory returns two values: the directory pathname and a flag indicating success. The successp flag will be nil if the dialog was cancelled, and t otherwise.

On Windows and Motif, if if-does-not-exist is :ok , a non-existent directory can be chosen. When set to :prompt , if a non-existent directory is chosen, the user is prompted for whether the directory should be created. When set to :error , the user cannot choose a non existent directory. The default value of if-does-not-exist is :prompt .

On Cocoa it is never possible to choose a non-existent directory, and the value of if-does-not-exist is ignored.

pathname , if non-nil, supplies an initial directory for the dialog. The default value for pathname is nil , and with this value the dialog initializes with the current working directory.

file-package-is-directory is handled as by prompt-for-file.

owner specifies an owner window for the dialog. See the "Prompting for Input" chapter in the CAPI User Guide for details.

If continuation is non-nil, then it must be a function with a lambda list that accepts two arguments. The continuation function is called with the values that would normally be returned by prompt-for-directory . On Cocoa, passing continuation causes the dialog to be made as a window-modal sheet and prompt-for-directory returns immediately, leaving the dialog on the screen. The with-dialog-results macro provides a convenient way to create a continuation function.

The prompt itself is created by passing an appropriate pane to popup-confirmer. Arguments can be passed to the make-instance of the pane and the call to popup-confirmer using pane-args and popup-args respectively. Currently, the pane used to create the file prompter is internal to the CAPI.

See also

popup-confirmer
prompt-for-file


CAPI Reference Manual - 15 Dec 2011

NextPrevUpTopContentsIndex