Prompts the user for a form to evaluate.
capi
prompt-for-value message &key package initial-value value-function pane-args popup-args continuation => value, okp
message⇩ |
A string or nil . |
package⇩ |
A package or nil . |
initial-value⇩ |
A symbol. |
value-function⇩ |
A function, or nil . |
pane-args⇩ |
Arguments to pass to the pane. |
popup-args⇩ |
Arguments to pass to the confirmer. |
continuation⇩ |
A function or nil . |
value |
A Lisp object. |
okp |
A boolean. |
The function prompt-for-value
prompts the user for a form and returns the result of evaluating that form.
The form is read in package if specified or *package* if not and the result is the evaluation of the form.
If initial-value is supplied it provides a default form.
If value-function is supplied it overrides the default value function which reads the form and evaluates it.
message supplies a title for the dialog.
If continuation is non-nil, then it must be a function with a lambda list that accepts two arguments. continuation is called with the values that would normally be returned by prompt-for-value
. On Cocoa, passing continuation causes the dialog to be made as a window-modal sheet and prompt-for-value
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 a 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-value "Square" :initial-value '(+ 1 2 3) :value-function #'(lambda (text) (let ((res (eval (read-from-string text)))) (* res res))))
CAPI User Guide and Reference Manual (Windows version) - 01 Dec 2021 19:33:57