prompt-for-integer message &key min max initial-value ok-check pane-args popup-args continuation => result, successp
A string.
An integer or
nil
.
An integer or
nil
.
An integer or
nil
.
A function or
nil
.
Arguments to pass to the pane.
Arguments to pass to the confirmer.
A function or
nil
.
The function
prompt-for-integer
pops up a text-input-pane and prompts the user for an integer, which is returned in
result.
When min or max are specified the allowable result is constrained accordingly.
initial-value
determines the initial value displayed in the dialog.
initial-value
defaults to the value of
min
, or if
min
is
nil
then no initial value is displayed.
Further restrictions can be applied by passing an
ok-check
function
. ok-check
should take one argument, the currently entered number, and should return
t
if it is valid. If
ok-check
is
nil
(the default) then there is no further restriction.
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-integer
. On Cocoa, passing
continuation
causes the dialog to be made as a window-modal sheet and
prompt-for-integer
returns immediately, leaving the dialog on the screen. The with-dialog-results macro provides a convenient way to create a
continuation
function.
The prompter is created by passing text-input-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.
(capi:prompt-for-integer "Enter an integer:")
(capi:prompt-for-integer "Enter an integer:" :max 10)
(capi:prompt-for-integer "Enter an integer:"
:min 100 :max 200)
(capi:prompt-for-integer "Enter an integer:"
:ok-check 'evenp)