Rendering Recursive widgets

0 views
Skip to first unread message

jrwats

unread,
Nov 6, 2009, 11:26:52 AM11/6/09
to weblocks
Writing my first weblocks app and I've hitting a wall at the moment.
I'm attempting to render a recursive widget that represents a
directory. Goal is to have typical tree view - probably the exact
same thing as this user wanted:
http://groups.google.com/group/weblocks/browse_thread/thread/dcdb8482509348ab/0411b3e48cb17ad5?lnk=gst&q=tree#0411b3e48cb17ad5

Anyhow, I have the top widget working. It defaults to rendering
"collapsed" and when you click its name it attempts to render it
children, but it does so by using a different view:

Here's the pastebin all pretty and colored: http://paste.lisp.org/display/89899#1
.

I left out a lot of code, only pasting what I considered to be
relevant, hopefully this wasn't a misguided decision. In any case I
believe the problem to be calling:
(mapcar #'render-widget (children widget)
from within
render-view-field-value

as the error I get is:

There is no applicable method for the generic function #<STANDARD-
GENERIC-FUNCTION WEBLOCKS:DOM-CLASSES (4)> when called with arguments
(#<AW::DIR-TREE-WIDGET {100501D971}>).

I believe I read that this is the error one gets when using a widget
in a view context? So my question, then, is if I can't do the
recursion in the view, I'm not quite sure how to accomplish it in the
widget... so what do I do?

jrwats

unread,
Nov 6, 2009, 11:33:43 AM11/6/09
to weblocks
Feel free to tell me to stop re-inventing the wheel and just do the
following:
http://groups.google.com/group/weblocks/browse_thread/thread/3b626c8f551aa5f2
But I'm still curious...

jrwats

unread,
Nov 6, 2009, 2:26:06 PM11/6/09
to weblocks
OK now this is weird:

Changed

(mapcar #'render-widget (children widget))

to

(make-instance
'composite
:widgets (mapcar #'render-widget-body (children widget)))

Note that it was the change from render-widget to render-widget-body
that made the difference. Anyone know why?

Leslie P. Polzer

unread,
Nov 6, 2009, 3:02:03 PM11/6/09
to weblocks
On Nov 6, 8:26 pm, jrwats <jrw...@gmail.com> wrote:

> Note that it was the change from render-widget to render-widget-body
> that made the difference.  Anyone know why?

Does your dir-tree-widget inherit from widget?

Leslie

jrwats

unread,
Nov 6, 2009, 3:51:39 PM11/6/09
to weblocks
How embarrassing. You're right. I used defclass rather than
defwidget. Problem solved. Now on to making real views for these bad
boys.

Reply all
Reply to author
Forward
0 new messages