All Manuals > CAPI User Guide and Reference Manual > 21 CAPI Reference Entries

NextPrevUpTopContentsIndex

prompt-for-value

Function
Summary

Prompts the user for a form to evaluate.

Package

capi

Signature

prompt-for-value message &key package initial-value value-function pane-args popup-args continuation

Description

The function prompt-for-value prompts the user for a form and returns the result of evaluating that form.

The form is read in the 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.

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-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.

Example
(capi:prompt-for-value 
 "Square" 
 :initial-value '(+ 1 2 3) 
 :value-function 
 #'(lambda (text) 
     (let ((res (eval (read-from-string text))))
       (* res res))))
See also

prompt-for-form


CAPI User Guide and Reference Manual (Macintosh version) - 3 Aug 2017

NextPrevUpTopContentsIndex