Page 320 Table of Contents Index Page 322
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
 
 ;; Create the start and stop push buttons
 (make-pane 'push-button
            :label "Start"
            :client frame :id 'start)
 (make-pane 'push-button
            :label "Stop"
            :client frame :id 'stop)

Another way to distinguish between gadgets is to explicitly specify what function should be
called when the callback is invoked. This is specified when the gadget is created by supplying
an appropriate initarg. The above example could then be written as follows:
 
 ;; No callback methods needed, just create the push buttons
 (make-pane 'push-button
            :label "Start"
            :client frame :id 'start
            :activate-callback
              #'(lambda (gadget)
                  (start-test (gadget-client gadget))))
 (make-pane 'push-button
            :label "Stop"
            :client frame :id 'stop
            :activate-callback
              #'(lambda (gadget)
                  (stop-test (gadget-client gadget))))


30.2.2 Implementing Gadgets

The following shows how a push button gadget might be implemented.
 
 ;; A PUSH-BUTTON uses the ACTIVATE-CALLBACK, and has a label.
 ;; This is the abstract class
 (defclass push-button (action-gadget labelled-gadget) ())

 ;; Here is a concrete implementation of a PUSH-BUTTON.
 ;; The "null" frame manager create a pane of type PUSH-BUTTON-PANE when
 ;; asked to create a PUSH-BUTTON.
 (defclass push-button-pane
     (push-button
      leaf-pane
      space-requirement-mixin)
   ((show-as-default :initarg :show-as-default
                     :accessor push-button-show-as-default)
    (armed :initform nil)))

 ;; General highlight-by-inverting method


Page 320 Table of Contents Index Page 322
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