CLIM mail archive

[Prev][Next][Index][Thread]

changing value for list pane gadget




Hi,
I'd like to have a list-pane gadget whose value I can change programmatically
(as well as by pointer events).  I thought the correct way to do this would
be to call (setf (gadget-value <gadget> :invoke-callback t) <value>), but
this isn't working properly: the value changes, but the list-pane
highlighting isn't affected.  It turns out the gadget doesn't seem to have
a gadget-value-changed-callback method, which makes me wonder how the
highlighting gets changed as a result of pointer events.  Shouldn't a
list-pane have a default method for this?  How can I get this to do what
I want it to do?

Thanks,
Suzanne Paley

Example:

(defvar *items* '(apples bananas cherries dates))

(clim:define-application-frame list-pane-test ()
  ((selections :accessor list-pane-selections))
  (:pane
   (clim:with-application-frame (frame)
     (clim:vertically ()
       (setf (list-pane-selections frame) 
	     (clim:make-pane 'clim:list-pane 
			     :mode :some-of
			     :client frame
			     :items *items*
			     ))
       (clim:horizontally ()
         (clim:make-pane 'clim:push-button :label "Select All"
			 :client frame
			 :activate-callback
			 #'(lambda (gadget)
			     (setf (clim:gadget-value 
				    (list-pane-selections
				     (clim:gadget-client gadget))
				    :invoke-callback t) 
				   *items*)
			     ))
	 (clim:make-pane 'clim:push-button :label "Deselect All"
			 :client frame
			 :activate-callback
			 #'(lambda (gadget)
			     (setf (clim:gadget-value 
				    (list-pane-selections
				     (clim:gadget-client gadget))
				    :invoke-callback t) 
				   nil)
			     )))
       (clim:make-pane 'clim:push-button :label "Abort"
		       :client frame
		       :activate-callback
		       #'(lambda (gadget)
			   (clim:frame-exit (clim:gadget-client gadget))
			   ))
       ))))

(defun run-test ()
  (clim:run-frame-top-level
   (clim:make-application-frame 'list-pane-test)))

-------


Main Index | Thread Index