Hi Tomas,
now I tried some of the proposals I made.
1. We can avoid the group association list completely, if we store a
'+field' reference into components that are not the group leader.
2. We can directly use the '<radio>' function, simplifying the code a
little
Regarding that, here's a modified version of your '+Radio' class:
################################################################
(class +Radio +field)
# grp val lbl
# (grp val [lbl])
(dm T (Grp Val Lbl)
(super)
(=: grp (field Grp))
(=: val Val)
(=: lbl Lbl) )
(dm show> ("Var")
(showFld
(<radio>
(ifn (: grp)
"Var"
(cons '*Gui (: grp id)) )
(: val)
(not (able)) ) ) )
(dm set> (Val Dn)
(unless (: grp)
(super Val Dn) ) )
(dm val> ()
(unless (: grp)
(super) ) )
################################################################
I can be called like this:
(gui '(+Radio) NIL "value1a")
(gui '(+Radio) -1 "value1b")
(gui '(+Radio) -2 "value1c")
...
(gui '(+Radio) NIL "value2a")
(gui '(+Radio) -1 "value2b")
(gui '(+Radio) -2 "value2c")
So the NIL argument indicates a group leader. For other group members,
you can pass a standard field specifier (i.e. a numeric field offset or
an alias symbol) as expected by the built-in 'field' function.
With aliases for the group leaders, the above example would be:
(gui 'group1 '(+Radio) NIL "value1a")
(gui '(+Radio) 'group1 "value1b")
(gui '(+Radio) 'group1 "value1c")
...
(gui 'group2 '(+Radio) NIL "value2a")
(gui '(+Radio) 'group2 "value2b")
(gui '(+Radio) 'group2 "value2c")
One downer remains, though: As I suspected, "lib/form.js" does not work
with radio buttons. I'll have to check that separately.
Cheers,
- Alex
--
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]