Re: how to make radio buttons without default selected? and, how to force all de-selected?



On Tue, Jan 25, 2005 at 01:27:14PM -0500, Owen Taylor wrote:
> On Mon, 2005-01-24 at 13:24 -0800, Ben Johnson wrote:
...
> > like a set of related toggle buttons.  Now I want them to behave *more*
> > like toggle buttons.  The problem is, there is always at least one of
> > the buttons selected.  I want the set to start out with no default
> 
> Maybe just use a set of related toggle-buttons? Even if you can find
> a workaround, it could easily break with a future version of GTK+.

That's actually what I did before I realized I was probably recreating a
wheel.  So, I already have something that works, but it's a bit of hack.
I'm starting to think about creating a new widget type, which would be a
lot cleaner than what I have now, but even that seems silly.

What I think I may really want is a one or two additional functions
added to the GtkRadioButton interface.

void
gtk_radio_button_allow_deselect(GtkRadioButton * button, gboolean allow);

I'm thinking that...  if I call this function on a given radio button,
no matter what it looks like (regular radio button or toggle button),
the result of a user clicking on an activated button is its
de-activation (and a "toggled" signal emmition, etc).  The de-activation
could also be accomplished through the gtk_toggle_button_set_active()
function.

I think that would be a pretty reasonable change.  It would add to the
flexibility and utilty of the widget without adversly affecting its
character.  Of course... I haven't even looked at the code, so I don't
know what problems this might cause.  (maybe I'll take a look.)

What do you think?  Good idea?  What are the chances of a change like
this making it into the library?

- Ben



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