LispWorks CAPI User Guide > 10 Prompting for Input > 10.2 Prompting for values


10.2.7 Prompting for Lisp objects

The CAPI provides a number of dialogs specifically designed for creating Lisp aware applications. The simplest is the function prompt-for-form which accepts an arbitrary Lisp form and optionally evaluates it.

 "Enter a form to evaluate:"
 :evaluate t)
 "Enter a form (not evaluated):"
 :evaluate nil)

Another useful function is prompt-for-symbol which prompts the user for an existing symbol. The simplest usage accepts any symbol, as follows:

 "Enter a symbol:")

If you have a list of symbols from which to choose, then you can pass prompt-for-symbol this list with the keyword argument :symbols .

Finally, using :ok-check you can accept only certain symbols. For example, to only accept a symbol which names a class, use:

 "Enter a class-name symbol:"
 :ok-check #'(lambda (symbol)
               (find-class symbol nil)))

Cocoa programmers will notice that the dialog sheet displayed by this form, like all those in this chapter so far, prevents input to other LispWorks windows while it is displayed. For information about creating dialog sheets which are not application-modal, see Window-modal Cocoa dialogs.

LispWorks CAPI User Guide (Unix version) - 22 Dec 2009