[cells-devel] Re: celtk expander

Andy Chambers achambers.home at googlemail.com
Fri Nov 2 20:59:12 UTC 2007


On 11/2/07, Andy Chambers <achambers.home at googlemail.com> wrote:

> (defmacro mk-expander ((&rest initargs) &rest kids)
>   `(make-instance 'expander , at initargs
>     :fm-parent *parent*
>     :expansion (c? (the-kids , at kids))
>     :expanded (c-in nil)
>     :kids (c? (the-kids
>               (mk-button-ex ((^label) (setf
>                                        (expanded (upper self expander))
>                                        (not (expanded (upper self expander))))))
>               (when (^expanded)
>                 (^expansion))))))

(defmacro mk-expander ((&rest initargs) &rest kids)
  `(make-instance 'expander , at initargs
    :fm-parent *parent*
    :expansion (c? (lambda ()
		     (the-kids , at kids)))
    :expanded (c-in nil)
    :kids (c? (the-kids
	      (mk-button-ex ((^label) (setf
				       (expanded (upper self expander))
				       (not (expanded (upper self expander))))))
	      (when (^expanded)
		(funcall (^expansion)))))))

wrapping the expansion rule inside a lambda works.  This creates a new
set of widgets each time the rule runs though.  Is there some way of
doing it without that?



More information about the cells-devel mailing list