Hi all...

I started playing with/digging into TG widgets and forms, and a few
things came to my mind that I felt I would share (not sure it's really
interesting but...).

* first thing:
an interesting feature of Zope is the ability to have multiple submits
on the same form, with a naming scheme specifying the real action for
the form, ie:
 <submit name="handlerMethodName:method" .... />
will use <current_controller>.handlerMethodName() as handler (ZPublisher
takes care of this dispatch)

(err... not sure I'm very clear... sorry)

This is definitively something I'd like to have in a TG forms/widgets
framework, and I thinks this could be easily implemented in TG (at least
with a default() handler doing the dispatch, but there may be better
options with cherryPy filters or whatever)


* Next thing is about form layout:

The TableForm strategy is a first angle, but it will only work for very
simple forms[1].

What I was thinking of is a combination of RowLayouts and ColumnLayout
(both being widgets and widgetContainers). A RowLayout could contain one
widget by cell, a ColumnLayout could contain one widget by line :

- simple row layout :
+---------+---------+---------+
| widget1 | widget2 | widget3 |
+---------+---------+---------+

- simple column layout :

+---------+
| widget1 |
+---------+
| widget2 |
+---------+
| widget3 |
+---------+

We could even make [Row|Column]Layouts accept many widget per cell, with
RowLayout displaying them vertically and ColumnLayout horizontally:

- multi row layout:
+---------+---------+
| widget1 | widget3 |
| widget2 | widget4 |
|         | widget5 |
+---------+---------+

- multi column layout :

+-------------------------+
| widget1 widget2 widget3 |
+-------------------------+
| widget4 widget5         |
+-------------------------+


Now RowLayout and ColumnLayout being widgets themselves, one can combine
them to make more complex layouts:

+-------------+------------------------+
| +---------+ | +--------------------+ |
| | widget1 | | | widget4  | widget6 | |
| +---------+ | | widget5  |         | |
| | widget2 | | +--------------------+ |
| +---------+ | +--------------------+ |
| | widget3 | | | widget 7           | |
| +---------+ | +--------------------+ |
+-------------+------------------------+


etc...

Since I do not yet fully understand how TG widgets work, I don't know
which implications it would have, but I guess this should be possible...
Now is it a good idea is another question !-)


[1] (TableForm...) and it needs to handle  hidden input widgets anyway
IMHO - I tried adding something like this yesterday, but I guess it was
way too late for my poor brain to still perform correctly :(

-- 
bruno desthuilliers
développeur
[EMAIL PROTECTED]
http://www.modulix.com

Reply via email to