[Bese-devel] Got in troubles again
Marco Baringer
mb at bese.it
Mon Aug 15 10:28:08 UTC 2005
Friedrich Dominicus <frido at q-software-solutions.de> writes:
> I do not understand what's wrong with the following code:
>
> ;;; Just for testing
> (defcomponent ir-test (simple-window-component form-component)
> ((num :accessor num
> :component (integer-range-field :min-value 0 :max-value 20))
> (foo-num :accessor foo-num
> :initarg :foo-num
> :component (integer-field))))
>
>
>
> (defmethod render-on ((res response) (tf ir-test))
> (render-on res (num tf))
> (render-on res (foo-num tf)))
>
>
>
> (defentry-point "ti.ucw" (:application *shop*) ()
> (call 'ir-test :foo-num 10))
the foo-num slot is assumed to be component, you've set it to 10,
which isn't a component. ucw barfs when it tries to set the place of
the number 10.
what you want is this:
(defmethod shared-initialize :after ((c ir-test) slot-names &key foo-num &allow-other-keys)
(setf (lisp-value (foo-num c)) foo-num))
iow you want the value passed as :foo-num to end up in a slot of the
underlying component.
the fact that this shared-initialize is neccessary is pretty ugly, but
i have yet to figure out a good way to structure it, suggestions
welcome.
--
-Marco
Ring the bells that still can ring.
Forget the perfect offering.
There is a crack in everything.
That's how the light gets in.
-Leonard Cohen
More information about the bese-devel
mailing list