10.1 path-dialog%
Superclass: dialog%
The path-dialog% class implements a platform-independent
file/directory dialog. The dialog is the same as the dialog under X
for MrEd's get-file, put-file,
get-directory, and get-file-list procedures, but
considerable extra functionality is available through the
class.
(->newpath-dialog% [(label_)] [(message_)] [(parent_)] [(directory_)] [(filename_)] [(put?_)] [(dir?_)] [(existing?_)] [(new?_)] [(multi?_)] [(can-mkdir?_)] [(filters_)] [(show-file?_)] [(show-dir?_)] [(ok?_)] [(guard_)])path-dialog%object
label=#f: string (up to 200 characters) or#f
message=#f: string (up to 200 characters) or#f
parent=#f:frame%ordialog%object or#f
directory=#f: path or#f
filename=#f: path or#f
put?=#f: boolean
dir?=#f: boolean
existing?=: boolean(notput?)
new?=#f: boolean
multi?=#f: boolean
can-mkdir?=: booleanput?
filters=#t: list of (list filter-name filter-glob),#f, or#t
show-file?=#f: path-to-boolean procedure or#f
show-dir?=#f: path-to-boolean procedure or#f
ok?=#f: path-to-boolean procedure or#f
guard=#f: procedure or#fThe
labelargument is the dialog's title string. Iflabelis#f, the default is based on other field values.The
messageargument is a prompt message to show at the top of the dialog. If it is#f, no prompt line.The
parentargument is the parent frame or dialog, if any, for this dialog.The
directoryargument specifies the dialog's initial directory. If it is#f, the initial directory is the last directory that was used by the user (or the current directory on first use).The
filenameargument provides an initial filename text, if any.If
put?is true, the dialog operates in choose-file-to-write mode (and warn the user if choosing an existing name).If
dir?is true, the dialog operates in directory-choice mode.If
existing?is true, the use must choose an existing file.If
new?is true, the user must choose a non-existant path. Providing bothnew?andexisting?as true triggers an exception.If
multi?is true, the dialog allows selection of multiple paths.If
can-mkdir?is true, the dialog includes a button for the user to create a new directory.The
filtersargument is one of:(list-of (-- a list of pattern names (e.g., ``Scheme Files'') and glob patterns (e.g.,listfilter-name filter-glob))"*.scm;*.ss"). Any list (including an empty list) enables a filter box for the user to enter glob patterns, and the given list of choices is available in a combo-box drop-down menu. Glob patterns are the usual Unix ones (seeglob->regexp), and a semicolon can be used to allow multiple patterns.#f-- no patterns and no filter input box.#t-- use a generic ``All'' filter, which is ``*.*'' on Windows and ``*'' on other platforms.
The
show-file?predicate is used to filter file paths that are shown in the dialog. The predicate is applied to the file name as a string while the current-directory parameter is set. This predicate is intended to be a lightweight filter for choosing which names to display.The
show-dir?predicate is similar, but for directories instead of files.The
ok?predicate is used in a similar fashion to theshow-file?andshow-dir?predicate, but it is used to determine whether the OK button should be enabled when a file or directory is selected (so it need not be as lightweight as the other predicates).The
guardprocedure is a generic verifier for the dialog's final result, as produced by therunmethod. It receives the result that is about to be returned (which can be a list in a multi-selection dialog), and can return a different value (any value) instead. If it throws an exception, an error dialog is shown, and the dialog interaction continues (so it can be used to verify results without dismissing the dialog). This procedure can also raise void, in which case the dialog remains without an error message.
Methods
run
All Methods
accept-drop-files from window<%>
add-child from area-container<%>
after-new-child from area-container<%>
begin-container-sequence from area-container<%>
border from area-container<%>
can-close? (augmentable only) from top-level-window<%>
can-exit? from top-level-window<%>
center from top-level-window<%>
change-children from area-container<%>
client->screen from window<%>
container-flow-modified from area-container<%>
container-size from area-container<%>
delete-child from area-container<%>
enable from window<%>
end-container-sequence from area-container<%>
focus from window<%>
get-alignment from area-container<%>
get-children from area-container<%>
get-client-size from window<%>
get-cursor from window<%>
get-edit-target-object from top-level-window<%>
get-edit-target-window from top-level-window<%>
get-eventspace from top-level-window<%>
get-focus-object from top-level-window<%>
get-focus-window from top-level-window<%>
get-graphical-min-size from area<%>
get-handle from window<%>
get-height from window<%>
get-label from window<%>
get-parent from area<%>
get-plain-label from window<%>
get-size from window<%>
get-top-level-window from area<%>
get-width from window<%>
get-x from window<%>
get-y from window<%>
has-focus? from window<%>
is-enabled? from window<%>
is-shown? from window<%>
min-height from area<%>
min-width from area<%>
move from top-level-window<%>
on-activate from top-level-window<%>
on-close (augmentable only) from top-level-window<%>
on-drop-file from window<%>
on-exit from top-level-window<%>
on-focus from window<%>
on-message from top-level-window<%>
on-move from window<%>
on-size from window<%>
on-subwindow-char from dialog%
overrides on-subwindow-char from window<%>
on-subwindow-event from window<%>
on-superwindow-enable from window<%>
on-superwindow-show from window<%>
on-system-menu-char from top-level-window<%>
on-traverse-char from top-level-window<%>
place-children from area-container<%>
popup-menu from window<%>
reflow-container from area-container<%>
refresh from window<%>
resize from top-level-window<%>
run from path-dialog%
screen->client from window<%>
set-alignment from area-container<%>
set-cursor from window<%>
set-label from window<%>
show from dialog%
overrides show from top-level-window<%>
overrides show from window<%>
spacing from area-container<%>
stretchable-height from area<%>
stretchable-width from area<%>