8.2 Prompting for values

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

(prompt-for-form
 "Enter a form to evaluate:"
 :evaluate t)

(prompt-for-form "Enter a form to evaluate:" :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:

(prompt-for-symbol
 "Enter a symbol:")

If you have a list of symbols from which to choose, then you can passprompt-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:

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


CAPI User Guide, Liquid Common Lisp Version 5.0 - 2 OCT 1997

Generated with Harlequin WebMaker