2 Getting Started
Note that the result of the callback function is ignored, and that its usefulness is in its side-effects.
(make-instance 'push-button :data "Hello" :callback #'(lambda (&rest args) (display-message "Hello World")))
Figure 2.3 Specifying a callback
display-messageto allow you to pop up a dialog box containing a message and a Confirm button. This is one of many pre-defined facilities that the CAPI offers.
Note: When developing applications in the CAPI, note that your CAPI application windows are run in the same X Window System event loop as the Common LispWorks environment itself. This - and the fact that in Common Lisp, user code exists in the same global namespace as the Common Lisp implementation itself - means that a CAPI application running under the Common LispWorks environment can modify the same values as you can concurrently modify from one of the environment's programming tools.
For example, your CAPI application might have a button that, when pressed, sets a slot in a particular object that you could also set by hand in the listener. This situation can lead to unexpected values and behavior in your CAPI application, which may seem to reveal bugs in the application or the Common Lisp product that do not in fact exist.
Generated with Harlequin WebMaker