Design problem with radio items



Hi Michael,

I think there is some little design problem with the way radio items
work at the moment.

Currently, radio items are basically implemented as a group of check
items, but only one of them can be active at any time.

Let's assume you have the following:

===
<menuitem name="InterpolationNearest" _label="Nea_rest Neighbour Interpolation"
        type="radio" group="Interpolation" verb=""/>
<menuitem name="InterpolationTiles" _label="_Tiles Interpolation"
        type="radio" group="Interpolation" verb=""/>
<menuitem name="InterpolationBilinear" _label="_Bilinear Interpolation"
        type="radio" group="Interpolation" verb=""/>
<menuitem name="InterpolationHyperbolic" _label="_Hyperbolic Interpolation"
        type="radio" group="Interpolation" verb=""/>
====

When "InterpolationNearest" is selected and the user selects another item,
for instance "InterpolationBilinear", the state of "InterpolationNearest"
is set to "0" and then the state of "InterpolationBilinear" is set to "1".

Wouldn't it be more logical to have one ID "Interpolation" per radio group
and then set the state to "bilinear" on it when the user selects this ?

The current design has two problems:

1.) after setting the state of the old item ("InterpolationNearest") to "0"
    (and before setting the state of the new one to "1"), the radio group
    has an invalid state (no item is selected).

2.) from the component point of view, it's more work to add listeners for
    all the IDs of one radio group and only perform an action when the
    state is "1" than to provide one listener for the whole radio group.

I don't have a patch yet, but I can make one :-)

-- 
Martin Baulig
martin gnome org (private)
baulig suse de (work)




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]