[cells-devel] Where do you keep the models?

Andy Chambers achambers.home at googlemail.com
Sat Aug 18 23:29:02 UTC 2007


Where should you keep the data in a celtk app.  I tried doing the following...

(defmodel app (window)
  ((my-model :initform nil :initarg :model :accessor my-model))
  (:default-initargs
      :kids (c? (the-kids
		 (mk-row (:packing (c?pack-self))
                   (mk-popup-menubutton
                    :id :view-selector
		    :initial-value (c? (first (^entry-values)))
		    :entry-values (c? '(codelists items item-groups forms events)))
                   (mk-text-widget
		    :id :display
		    :value (c? (if *odm*
				   (case (selection (fm^ :view-selector))
				     (codelists
				      (codelists *odm*))
				     (items
				      (items *odm*))
				     (t (xml *odm*)))))))))))


...but I couldn't work out how to access my-model from the text
widget's (c? ...).  What you see above is what I changed it to in
order to make it access the global *odm* variable which is elsewhere
set to be a normal cells instance.  Is there a way to keep it all in
the app?  I'd like to make it so that my-model is set by the result of
a file-open dialog.

Cheers,
Andy



More information about the cells-devel mailing list