On this page:
2.2.1 Dialogs
get-file
get-file-list
put-file
get-directory
message-box
message-box/ custom
message+ check-box
message+ check-box/ custom
get-text-from-user
get-choices-from-user
get-color-from-user
get-font-from-user
get-ps-setup-from-user
get-page-setup-from-user
can-get-page-setup-from-user?
2.2.2 Eventspaces
make-eventspace
current-eventspace
eventspace?
event-dispatch-handler
check-for-break
get-top-level-windows
get-top-level-focus-window
get-top-level-edit-target-window
special-control-key
special-option-key
queue-callback
yield
sleep/ yield
eventspace-shutdown?
eventspace-handler-thread
2.2.3 System Menus
current-eventspace-has-standard-menus?
current-eventspace-has-menu-root?
application-about-handler
application-preferences-handler
application-quit-handler
application-file-handler
2.2.4 Miscellaneous
begin-busy-cursor
bell
end-busy-cursor
file-creator-and-type
find-graphical-system-path
get-default-shortcut-prefix
get-panel-background
get-resource
get-window-text-extent
graphical-read-eval-print-loop
textual-read-eval-print-loop
hide-cursor-until-moved
is-busy?
label->plain-label
make-gui-empty-namespace
make-gui-namespace
play-sound
send-event
send-message-to-window
system-position-ok-before-cancel?
the-clipboard
the-x-selection-clipboard
write-resource
Version: 4.1.3.3

2.2 Windowing Functions

    2.2.1 Dialogs

    2.2.2 Eventspaces

    2.2.3 System Menus

    2.2.4 Miscellaneous

2.2.1 Dialogs

These functions get input from the user and/or display messages.

(get-file [message    
  parent    
  directory    
  filename    
  extension    
  style    
  filters])  (or/c path? false/c)
  message : (or/c string? false/c) = #f
  parent : (or/c (is-a?/c frame%) (is-a?/c dialog%) false/c)
   = #f
  directory : (or/c path-string? false/c) = #f
  filename : (or/c path-string? false/c) = #f
  extension : (or/c string? false/c) = #f
  style : (listof (one-of/c 'packages 'enter-packages)) = null
  filters : (listof (list/c string? string?)) = '(("Any" "*.*"))

Obtains a file pathname from the user via the platform-specific standard (modal) dialog, using parent as the parent window if it is specified, and using message as a message at the top of the dialog if it is not #f.

The result is #f if the user cancels the dialog, the selected pathname otherwise. The returned pathname may or may not exist, although the style of the dialog is directed towards selecting existing files.

If directory is not #f, it is used as the starting directory for the file selector (otherwise the starting directory is chosen automatically in a platform-specific manner, usually based on the current directory and the user’s interactions in previous calls to get-file, put-file, etc.). If filename is not #f, it is used as the default filename when appropriate, and it should not contain a directory path prefix.

Under Windows, if extension is not #f, the returned path will use the extension if the user does not supply one; the extension string should not contain a period. The extension is ignored on other platforms.

The style list can contain 'common, a platform-independent version of the dialog is used instead of a native dialog. Under Mac OS X, if the style list contains 'packages, a user is allowed to select a package directory, which is a directory with a special suffix (e.g., “.app”) that the Finder normally displays like a file. If the list contains 'enter-packages, a user is allowed to select a file within a package directory. If the list contains both 'packages and 'enter-packages, the former is ignored.

Under Windows and X, filters determines a set of filters from which the user can choose in the dialog. Each element of the filters list contains two strings: a description of the filter as seen by the user, and a filter pattern matched against file names.

See also path-dialog%.

(get-file-list [message    
  parent    
  directory    
  filename    
  extension    
  style    
  filters])  (or/c (listof path?) false/c)
  message : (or/c string? false/c) = #f
  parent : (or/c (is-a?/c frame%) (is-a?/c dialog%) false/c)
   = #f
  directory : (or/c path-string? false/c) = #f
  filename : (or/c path-string? false/c) = #f
  extension : (or/c string? false/c) = #f
  style : null? = null
  filters : (listof (list/c string? string?)) = '(("Any" "*.*"))

Like get-file, except that the user can select multiple files, and the result is either a list of file paths of #f.

(put-file [message    
  parent    
  directory    
  filename    
  extension    
  style    
  filters])  (or/c path? false/c)
  message : (or/c string? false/c) = #f
  parent : (or/c (is-a?/c frame%) (is-a?/c dialog%) false/c)
   = #f
  directory : (or/c path-string? false/c) = #f
  filename : (or/c path-string? false/c) = #f
  extension : (or/c string? false/c) = #f
  style : (listof (one-of/c 'packages 'enter-packages)) = null
  filters : (listof (list/c string? string?)) = '(("Any" "*.*"))

Obtains a file pathname from the user via the platform-specific standard (modal) dialog, using parent as the parent window if it is specified, and using message as a message at the top of the dialog if it is not #f.

The result is #f if the user cancels the dialog, the selected pathname otherwise. The returned pathname may or may not exist, although the style of the dialog is directed towards creating a new file.

If directory is not #f, it is used as the starting directory for the file selector (otherwise the starting directory is chosen automatically in a platform-specific manner, usually based on the current directory and the user’s interactions in previous calls to get-file, put-file, etc.). If filename is not #f, it is used as the default filename when appropriate, and it should not contain a directory path prefix.

Under Windows, if extension is not #f, the returned path will get a default extension if the user does not supply one. If extension is the empty string, then the extension is derived from the user’s filters choice if the corresponding pattern is of the form (string-append "*." extension); if the pattern is "*.*", then no default extension is added. Finally, if extension is any string other than the empty string, extension is used as the default extension when the user’s filters choice has the pattern "*.*". Meanwhile, the filters argument has the same format and auxiliary role as for get-file. In particular, if the only pattern in filters is (string-append "*." extension), then the result pathname is guaranteed to have an extension mapping extension.

Under Mac OS X 10.5 and later, if extension is not #f, the returned path will get a default extension if the user does not supply one. If filters contains as "*.*" pattern, then the user can supply any extension that is recognized by the system; otherwise, the extension on the returned path will be either extension or other-extension for any (string-append "*." other-extension) pattern in filters. In particular, if the only pattern in filters is empty or contains only (string-append "*." extension), then the result pathname is guaranteed to have an extension mapping extension.

Under Mac OS X versions before 10.5, the returned path will get a default extension only if extension is not #f and filters contains only (string-append "*." extension).

The extension argument is ignored under X, and filters can be used to specify glob-patterns.

The style list is treated as for get-file.

See also path-dialog%.

(get-directory [message    
  parent    
  directory    
  style])  (or/c path false/c)
  message : (or/c string? false/c) = #f
  parent : (or/c (is-a?/c frame%) (is-a?/c dialog%) false/c)
   = #f
  directory : (or/c path? false/c) = #f
  style : (listof (one-of/c 'enter-packages)) = null

Obtains a directory pathname from the user via the platform-specific standard (modal) dialog, using parent as the parent window if it is specified.

If directory is not #f, it is used on some platforms as the starting directory for the directory selector (otherwise the starting directory is chosen automatically in a platform-specific manner, usually based on the current directory and the user’s interactions in previous calls to get-file, put-file, etc.).

The style argument is treated as for get-file, except that only 'common or 'enter-packages can be specified. The latter matters only under Mac OS X, where 'enter-packages enables the user to select package directory or a directory within a package. A package is a directory with a special suffix (e.g., “.app”) that the Finder normally displays like a file.

See also path-dialog%.

(message-box title message [parent style])
  (one-of/c 'ok 'cancel 'yes 'no)
  title : label-string?
  message : string
  parent : (or/c (is-a?/c frame%) (is-a?/c dialog%) false/c)
   = #f
  style : (listof (one-of/c 'ok 'ok-cancel 'yes-no 'caution 'stop))
   = '(ok)

See also message-box/custom.

Displays a message to the user in a (modal) dialog, using parent as the parent window if it is specified. The dialog’s title is title. The message string can be arbitrarily long, and can contain explicit linefeeds or carriage returns for breaking lines.

The style must include exactly one of the following:

In addition, style can contain 'caution to make the dialog use a caution icon instead of the application (or generic “info”) icon. Alternately, it can contain 'stop to make the dialog use a stop icon. If style contains both 'caution and 'stop, then 'caution is ignored.

The class that implements the dialog provides a get-message method that takes no arguments and returns the text of the message as a string. (The dialog is accessible through the get-top-level-windows function.)

(message-box/custom title 
  message 
  button1-label 
  button2-label 
  button3-label 
  [parent 
  style 
  close-result]) 
  (one-of/c 1 2 3 close-result)
  title : label-string?
  message : string
  button1-label : (or/c label-string? (is-a?/c bitmap%) false/c)
  button2-label : (or/c label-string? (is-a?/c bitmap%) false/c)
  button3-label : (or/c label-string? (is-a?/c bitmap%) false/c)
  parent : (or/c (is-a?/c frame%) (is-a?/c dialog%) false/c)
   = #f
  style : 
(listof (one-of/c 'stop 'caution 'number-order
                  'disallow-close 'no-default
                  'default=1 'default=2 'default=3))
   = '(no-default)
  close-result : any/c = #f

Displays a message to the user in a (modal) dialog, using parent as the parent window if it is specified. The dialog’s title is title. The message string can be arbitrarily long, and can contain explicit linefeeds or carriage returns for breaking lines.

The dialog contains up to three buttons for the user to click. The buttons have the labels button1-label, button2-label, and button3-label, where #f for a label indicates that the button should be hidden.

If the user clicks the button labelled button1-label, a 1 is returned, and so on for 2 and 3. If the user closes the dialog some other way – which is only allowed when style does not contain 'disallow-close – then the result is the value of close-result. For example, the user can usually close a dialog by typing an Escape. Often, 2 is an appropriate value for close-result, especially when Button 2 is a Cancel button.

If style does not include 'number-order, the order of the buttons is platform-specific, and labels should be assigned to the buttons based on their role:

Despite the above guidelines, any combination of visible buttons is allowed in the dialog.

If style includes 'number-order, then the buttons are displayed in the dialog left-to-right with equal spacing between all buttons, though aligned within the dialog (centered or right-aligned) in a platform-specific manner. Use 'number-order sparingly.

The style list must contain exactly one of 'default=1, 'default=2, 'default=3, and 'no-default to determine which button (if any) is the default. The default button is “clicked” when the user types Return. If 'default=n is supplied but button n has no label, then it is equivalent to 'no-default.

In addition, style can contain 'caution to make the dialog use a caution icon instead of the application (or generic “info”) icon. Alternately, it can contain 'stop to make the dialog use a stop icon. If style contains both 'caution and 'stop, then 'caution is ignored.

The class that implements the dialog provides a get-message method that takes no arguments and returns the text of the message as a string. (The dialog is accessible through the get-top-level-windows function.)

(message+check-box title 
  message 
  check-label 
  [parent 
  style]) 
  (one-of/c 'ok 'cancel 'yes 'no)
  title : label-string?
  message : string
  check-label : label-string?
  parent : (or/c (is-a?/c frame%) (is-a?/c dialog%) false/c)
   = #f
  style : 
(listof (one-of/c 'ok 'ok-cancel 'yes-no
                  'caution 'stop 'checked))
 = '(ok)

See also message+check-box/custom.

Like message-box, except that

(message+check-box/custom title 
  message 
  check-label 
  button1-label 
  button2-label 
  button3-label 
  [parent 
  style 
  close-result]) 
  (one-of/c 1 2 3 close-result)
  title : label-string?
  message : string
  check-label : label-string?
  button1-label : (or/c label-string? (is-a?/c bitmap%) false/c)
  button2-label : (or/c label-string? (is-a?/c bitmap%) false/c)
  button3-label : (or/c label-string? (is-a?/c bitmap%) false/c)
  parent : (or/c (is-a?/c frame%) (is-a?/c dialog%) false/c)
   = #f
  style : 
(listof (one-of/c 'stop 'caution 'number-order
                  'disallow-close 'no-default
                  'default=1 'default=2 'default=3))
   = '(no-default)
  close-result : any/c = #f

Like message-box/custom, except that

(get-text-from-user title    
  message    
  [parent    
  init-val    
  style])  (or/c string? false/c)
  title : string
  message : (or/c string? false/c)
  parent : (or/c (is-a?/c frame%) (is-a?/c dialog%) false/c)
   = #f
  init-val : string? = ""
  style : (listof (one-of/c 'password)) = null

Gets a text string from the user via a modal dialog, using parent as the parent window if it is specified. The dialog’s title is title. The dialog’s text field is labelled with message and initialized to init-val (but init-val does not determine the size of the dialog).

The result is #f if the user cancels the dialog, the user-provided string otherwise.

If style includes 'password, the dialog’s text field draws each character of its content using a generic symbol, instead of the actual character.

(get-choices-from-user title 
  message 
  choices 
  [parent 
  init-choices 
  style]) 
  (or/c (listof exact-nonnegative-integer?)