NextPrevUpTopContentsIndex

10.5.4 Integrating Gadgets and Output Records

In addition to gadget panes, CLIM allows gadgets to be used inside of CLIM stream panes. For instance, an accepting-values pane whose fields consist of gadgets may appear in an ordinary CLIM stream pane.

Note that many of the functions in the output record protocol must correctly manage the case where output records contain gadgets. For example, (setf output-record-position) may need to notify the host window system that the toolkit object representing the gadget has moved, window-clear needs to deactive any gadgets, and so forth.

gadget-output-record

Summary: The instantiable class that represents an output record class that contains a gadget. This is a subclass of output-record .

with-output-as-gadget [Macro]	

Arguments: (stream &rest options) &body body

Summary: Invokes body to create a gadget, and then creates a gadget output record that contains the gadget and installs it into the output history of the output recording stream stream . The returned value of body must be the gadget.

The options in options are passed as initargs to the call to invoke-with-new-output-record that is used to create the gadget output record.

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 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))

An 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)
                        (frame-exit (pane-frame button)))))

CommonLisp Interface Manager 2.0 User's Guide - 30 Jul 2004

NextPrevUpTopContentsIndex