10.5 Gadgets

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 [Class]

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]
(stream&rest options)&body body
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:

         (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))
An example of a push button that calls back into the presentation type system to execute a command might be as follows:

         (make-pane 'push-button 
                    :label "Click here to exit" 
                    #'(lambda (button)
                        (frame-exit (pane-frame button)))))

CLIM 2.0 User's Guide - OCT 1998

Generated with Harlequin WebMaker