prompt-for-form message &key package initial-value evaluate quotify ok-check value-function pane-args popup-args continuation => result , okp
The function
prompt-for-form
prompts the user for a form by providing a text input pane that the form can be typed into.
The form is read in the
package
if specified or
*package*
if not. If
evaluate
is non-
nil
then the result is the evaluation of the form, otherwise it is just the form itself. The printed version of
initial-value
will be placed into the text input pane as a default, unless
quotify
, which defaults to
evaluate
, specifies otherwise. If
value-function
is provided it overrides the default value function which reads the form and evaluates it when required. If the
ok-check
is provided it will be passed the entered form and should return
t
if the form is a valid result.
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-form
. On Cocoa, passing
continuation
causes the dialog to be made as a window-modal sheet and
prompt-for-form
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 calling prompt-for-string. Arguments can be passed to the
make-instance
of the pane and the call to
popup-confirmer using
pane-args
and
popup-args
respectively, and an input history can be implemented by supplying a
history-function
or
history-symbol
in
popup-args
.
Try the following examples, and each time enter
(+ 1 2)
into the input pane.
(capi:prompt-for-form "Enter a form:")
(capi:prompt-for-form "Enter a form:" :evaluate nil)