Page 333 Table of Contents Index Page 335
Chapters
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30
A, B, C, D, E



CHAPTER 30. GADGETS

=> with-output-as-gadget (stream) &body body [Macro]
Invokes body to create a gadget, and then creates a gadget output record that contains the gadget
and install's it into the output history of the output recording stream stream. The returned value
of body must be the gadget.

The stream argument is not evaluated, and must be a symbol that is bound to an output recording
stream. If stream is t, *standard-output* is used. body may have zero or more declarations as
its first forms.

For example, the following could be used to create an output record containing a radio box that
itself contains several toggle buttons:
 
 (with-output-as-gadget (stream)
   (let* ((radio-box
            (make-pane 'radio-box
                       :client stream :id 'radio-box)))
     (dolist (item sequence)
       (make-pane 'toggle-button
                  :label (princ-to-string (item-name item))
                  :value (item-value item)
                  :id item :parent radio-box))
     radio-box))

A more complex (and somewhat contrived) example of a push button that calls back into the
presentation type system to execute a command might be as follows:
 
 (with-output-as-gadget (stream)
   (make-pane 'push-button
              :label "Click here to exit"
              :activate-callback
                #'(lambda (button)
                    (declare (ignore button))
                    (throw-highlighted-presentation
                      (make-instance 'standard-presentation
                                     :object `(com-exit ,*application-frame*)
                                     :type 'command)
                      *input-context*
                      (make-instance 'pointer-button-press-event
                                     :sheet (sheet-parent button)
                                     :x 0 :y 0
                                     :modifiers 0
                                     :button +pointer-left-button+)))))


Page 333 Table of Contents Index Page 335
Chapters
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30
A, B, C, D, E