1 CAPI Reference Entries

prompt-for-string

Function

Summary

Theprompt-for-string function pops up a text input pane and prompts the user for a string.

Syntax

prompt-for-string message
                  &key
                  text initial-value print-function
                  value-function ok-check
                  pane-args popup-args

Description

This function prompts the user for a string and returns that string and a flag indicating that the dialog was not cancelled. The initial string can either be passed in as text using the text argument, or by passing a value and aprint-function for that value. If theprint-function is not specified, then it will default toprinc-to-string. The value returned can be converted into a different value by passing a value-function, which by default is identity. This value-function gets passed the text that was entered into the pane, and should return both the value to return and a flag that should be non-nil if the value that was entered is not acceptable. If an ok-check is passed, then it should return non-nil if the value about to be returned is acceptable.

Finally, as with all of the prompting functions, the prompter is created by passing an appropriate pane (in this case a text input pane) topopup-confirmer. Arguments can be passed to themake-instance of the pane and the call topopup-confirmer using pane-args and popup-args respectively.

Examples

(capi:prompt-for-string "Enter a string:")

(capi:prompt-for-string "Enter an integer:" :initial-value 10 :value-function #'(lambda (x) (let ((integer (ignore-errors (read-from-string x)))) (values integer (not (integerp integer)) ))))

See Also

popup-confirmer
text-input-pane


CAPI Reference Manual, Liquid Common Lisp Version 5.0 - 3 OCT 1997

Generated with Harlequin WebMaker