Displays a text input pane and prompts the user for a form.
capi
prompt-for-form message &key package initial-value evaluate quotify ok-check value-function pane-args popup-args continuation => result, okp
message⇩ |
A string or nil . |
package⇩ |
A package or nil . |
initial-value⇩ |
A Lisp object. |
evaluate⇩ |
A generalized boolean. |
quotify⇩ |
A generalized boolean. |
ok-check⇩ |
A function or nil . |
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 . |
result |
A Lisp object. |
okp |
A boolean. |
The function prompt-for-form
prompts the user for a form by providing a text input pane that the form can be typed into.
message supplies a title for the dialog.
The form is read in 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 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. continuation 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)
prompt-for-forms
prompt-for-string
popup-confirmer
text-input-pane
10 Dialogs: Prompting for Input
CAPI User Guide and Reference Manual (Macintosh version) - 01 Dec 2021 19:31:27