Re: selectable model discussion

Charles Goodwin <[email protected]> Fri, 02 Jan 2004 23:56:26 +0000
Newsgroups gmane.comp.java.xwt.widgets
Organization XWT Foundation
Message-ID <[email protected]>
On Fri, 2004-01-02 at 22:43, Tupshin Harper wrote:
> After re-reading your original message, I see your point about why that 
> would be the case, but no, it strikes me as counter-intuitive. I bet 
> many people when working with radio button groups, where only one item 
> can be selected, would assume that group.selected would always return 
> the currently selected item, which (almost coincidentally) most of the 
> time, it would.

Other than when none is selected, it _always_ would for radio groups.

> Certainly, a name change for group.selected along the lines of what 
> david suggested would help. If so, I would prefer to have the current 
> selection array be group.selected instead of group.selection. This seems 
> to be a much more intuitive name for describing the current state of the 
> widget.

Well, for me 'selected' implies singular and 'selection', plural.

Perhaps it could be simplified to just two traps:

$group.selection; // an array of selected members
                  // - in the order they were selected
$group.selected;  // the most recently selected member
                  // - null if nothing is selected
                  // - a shortcut to selection[selection.length]
                  // - put to when a selection is made

Ignoring the names (we'll obviously go with consensus), is that a little
tidier than using 3 values?  I'm a little concerned at the awkwardness
of accessing the most recently _unselected_ group member.

I'm still not satisfied.  I'll think about it overnight and come back
with a better option.

- Charlie

-- 
Charles Goodwin <[email protected]>
Member of the XWT Foundation

The future of the net - www.xwt.org