When you want the user to enter a line of text -- for instance a search string -- a text input pane can be used.
(setq text (make-instance 'text-input-pane
:title "Search: "
:callback 'test-callback))
(contain text)
Notice that the default title position for text input panes is
:left
.
You can place text programmatically in the text input pane by supplying a string for the
:text
initarg, or later by calling
(setf text-input-pane-text)
in the appropriate process.
You can add toolbar buttons for easier user input via the
:buttons
initarg. This example allows the user to enter the filename of an existing Lisp source file, either directly or by selecting the file in a dialog raised by the
Browse File
button. There is also a
Cancel
button, but the default
OK
button is not displayed:
(capi:contain
(make-instance
'capi:text-input-pane
:buttons
(list :cancel t
:ok nil
:browse-file
(list :operation :open
:filter "*.LISP;*.LSP"))))
For a larger quantity of text use
multi-line-text-input-pane
.
CAPI User Guide (Macintosh version) - 30 Aug 2011