how to make radio buttons without default selected? and, how to force all de-selected?
- From: Ben Johnson <ben blarg net>
- To: gtk-list gnome org
- Subject: how to make radio buttons without default selected? and, how to force all de-selected?
- Date: Mon, 24 Jan 2005 13:24:25 -0800
Hi. My name is Ben Johnson. This is my first time posting, and I'm
pretty much a Gtk newbie.
I've successfully created a set of radio buttons that look and act a lot
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
selected, and I want to be able to de-select a button without having a
new one get activated.
so far all I've tried is using gtk_toggle_button_set_active() on each of
the buttons while I create them, and that doesn't work. Do I need to
call that function later? like after they've been displayed? or, is
there a different method/function I need to use? My strategy for
allowing de-selection is running this same function in the "clicked"
signal handler. I haven't tried it yet because I'm guessing it won't
work.
Thanks for your help.
- Ben
/* this doesn't work like I hoped */
{
static GtkWidget * last_created = NULL;
if( ! last_created )
widget = gtk_radio_button_new_with_label(NULL, name);
else
widget = gtk_radio_button_new_with_label_from_widget(
GTK_RADIO_BUTTON(last_created), name);
/* draw like a regular toggle button */
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON(widget), FALSE);
/* no default selected */
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(widget), FALSE);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]