On 1/15/06, Mike Kent <[EMAIL PROTECTED]> wrote:
> After thinking about it a bit, I decided that what I really wanted was
> a Table widget, containing TableRow widgets, containing TableCell
> widgets.  Since no such widgets exists, I wanted to take a crack at
> writing them.  The TableForm widget is a container for other widget, so
> it seems to be a good place to start.  Unfortunately, after studying
> its source code for a while, I'm not getting anywhere; it's pretty
> dense and sparsly-documented.

Generally, the big problem that widgets are out to solve is form
input/output. Unless you're trying to take advantage of the
JavaScript/CSS inclusion features of widgets, I'd stick with Kid
(maybe using py:defs) to generate a table.

Beyond that, how you design a widget like this really depends on how
you want to hand in the data. Generally speaking, widgets are designed
to be stateless (they can have multiple requests going through them at
the same time). This design actually helps in this case. You can
create a table widget that takes TableRow and TableCell widgets in the
constructor. Then, you pass a 2D array (or whatever) in to insert() or
render() and your Table widget will pass each value in turn to the
TableRow which then passes the individual values to the TableCell. It
should work fine, it's just not what I generally had in mind for
widgets.

Kevin

>
> Has anyone else already taken a crack at a general-purpose table
> widget?  Can anyone give me some instruction on how to write a
> container widget of this type?
>
> Thanks,
> Mike
>
>


--
Kevin Dangoor
Author of the Zesty News RSS newsreader

email: [EMAIL PROTECTED]
company: http://www.BlazingThings.com
blog: http://www.BlueSkyOnMars.com

Reply via email to