16 GUI Utilities
Constructs a string whose size is less
than size by trimming the str
and inserting an ellispses into it.
Constructs a string whose length is less than
200 and,
if
quote-amp? is not
#f, then it also quotes
the ampersand in the result (making the string suitable for use in
menu-item% label, for example).
Formats a string whose ampersand characters are
mk-escaped; the label is also trimmed to <= 200
mk-characters.
Returns #t if cancel should be on the right-hand side (or below)
in a dialog and #f otherwise.
Just returns what system-position-ok-before-cancel? does.
Adds an Ok and a cancel button to a panel, changing the order
to suit the platform. Under Mac OS X and unix, the confirmation action
is on the right (or bottom) and under Windows, the canceling action is on
the right (or bottom).
The buttons are also sized to be the same width.
The first result is be the OK button and the second is
the cancel button.
By default, the confirmation action button has the '(border) style,
meaning that hitting return in the dialog will trigger the confirmation action.
The confirm-style argument can override this behavior, tho.
See button% for the precise list of allowed styles.
Returns a name for the next opened untitled frame. The first
name is “Untitled”, the second is “Untitled 2”,
the third is “Untitled 3”, and so forth.
This function is not a parameter.
Instead, the state is just stored in the closure.
The first case in the case lambda
returns the current delay in seconds before a watch cursor is shown,
when either gui-utils:local-busy-cursor or
gui-utils:show-busy-cursor is called.
Evaluates
(thunk) with a watch cursor. The argument
delay specifies the amount of time before the watch cursor is
opened. Use
gui-utils:cursor-delay to set this value
to all calls.
This function returns the result of thunk.
Use this function to delay an action for some period of time. It also
supports canceling the action before the time period elapses. For
example, if you want to display a watch cursor, but you only want it
to appear after 2 seconds and the action may or may not take more than
two seconds, use this pattern:
Creates a thread that waits delay-time. After delay-time
has elapsed, if the result thunk has not been called, call
open. Then, when the result thunk is called, call
close. The function close will only be called if
open has been called.
Evaluates
(thunk) with a watch cursor in
window. If
window is
#f, the watch cursor is turned on globally.
The argument
delay specifies the amount of time before the watch
cursor is opened. Use
gui-utils:cursor-delay
to set this value for all uses of this function.
The result of this function is the result of thunk.
This displays a dialog that warns the user of a unsaved file.
The string, action, indicates what action is about to
take place, without saving. For example, if the application
is about to close a file, a good action is "Close Anyway".
The result symbol indicates the user’s choice. If
can-save-now? is #f, this function does not
give the user the “Save” option and thus will not return
'save.
If cancel? is #t there is a cancel button
in the dialog and the result may be 'cancel. If it
is #f, then there is no cancel button, and 'cancel
will not be the result of the function.
Opens a dialog that presents a binary choice to the user. The user is
forced to choose between these two options, ie cancelling or closing the
dialog opens a message box asking the user to actually choose one of the
two options.
The dialog will contain the string message and two buttons,
labeled with the true-choice and the false-choice. If the
user clicks on true-choice #t is returned. If the user
clicks on false-choice, #f is returned.
The argument default-result determines how closing the window is
treated. If the argument is 'disallow-close, closing the window
is not allowed. If it is anything else, that value is returned when
the user closes the window.
If gui-utils:cancel-on-right?
returns #t, the false choice is on the right.
Otherwise, the true choice is on the right.
The style parameter is (eventually) passed to
message
as an icon in the dialog.
If checkbox-proc is given, it should be a procedure that behaves
like a parameter for getting/setting a boolean value. The intention for
this value is that it can be used to disable the dialog. When it is
given, a checkbox will appear with a checkbox-label label
(defaults to the dont-ask-again string constant), and that
checkbox value will be sent to the checkbox-proc when the dialog
is closed. Note that the dialog will always pop-up — it is the
caller’s responsibility to avoid the dialog if not needed.
If white-on-black? is true, the function returns
a delta suitable for use on a black background.
This delta is designed for use with
set-clickback.
Use the result of this function as the style
for the region text where the clickback is set.
If white-on-black? is true, the function returns
a delta suitable for use on a black background.
See also
gui-utils:get-clicked-clickback-delta.