RE: [gtk-list] Radio buttons and GSList



have you assigned them into their group ?

btn_grp = NULL;

btn = gtk_radio_button_new_with_label(NULL,"lbl");
gtk_box_pack_start(GTK_BOX(box),btn,TRUE,TRUE,0);
gtk_widget_show(btn);
btn_grp = gtk_radio_button_group(GTK_RADIO_BUTTON(btn));    <--- if you dont
assign 
                                                                 to the
group they
                                                                 do whatever
they want.

btn = gtk_radio_button_new_with_label(btn_grp,"lbl");
gtk_box_pack_start(GTK_BOX(box),btn,TRUE,TRUE,0);
gtk_widget_show(btn);
btn_grp = gtk_radio_button_group(GTK_RADIO_BUTTON(btn));




-----Original Message-----
From: K. M. Hawarden-Ogata [mailto:hawarden@duke.ifa.hawaii.edu]
Sent: Tuesday, May 11, 1999 6:01 PM
To: GTK List
Subject: [gtk-list] Radio buttons and GSList


Hello All,

I was wondering if someone could help me:

I am trying to set up four radio buttons (inside an hbox, inside a table)
using GSList. The buttons appear on the screen correctly. However, when I
depress them something weird happens:
If the first button (which I set as the active one) is depressed, I can
depress the other three. But when I depress the second or third button, the
buttons that were already depressed stay depressed. When I depress the
fourth button, the first button pops up (un-depresses) but then I can't
undepress the middle two. My understand (from the documentation) is that the
only button that should be depressed is the one you just clicked.

However, if there are only two buttons, this works fine.

What's going on?!?!?

I'd really appreciate any help......
Thanks in advance, Miranda

/------------------------------------------------------------------------\
| Miranda Hawarden-Ogata             Email: hawarden@irtf.ifa.hawaii.edu |
| NASA IRTF, Institute of Astronomy  Phone: (808) 974-4206               |
| 1175 Manono St., Bldg 393            Fax: (808) 974-4207               |
| Hilo, HI 96720                                                         |
\------------------------------------------------------------------------/

CODE:
The objects are declared correctly (as far as I can tell):
GtkWidget * table;
GtkWidget * hbox;
GtkWidget * widget;
GSList * view_group;

and the appropriate objects are displayed at the end of this section of
code.

/***** ROW 1 *****/
   /* View label */
 widget = gtk_label_new( "View: " );
 gtk_table_attach_defaults (GTK_TABLE(table), widget, 0, 1, 0, 1);
 gtk_widget_show(widget);

 hbox = gtk_hbox_new( FALSE, 5 );
   /* View 1 */
 widget = gtk_radio_button_new_with_label( NULL, "1" );
 view_group = gtk_radio_button_group( GTK_RADIO_BUTTON (widget ) );
 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON (widget ), TRUE );
 gtk_box_pack_start( GTK_BOX(hbox), widget , FALSE, FALSE, 0);
 gtk_widget_show(widget );

   /* View 2 */
 widget = gtk_radio_button_new_with_label( view_group, "2" );
 gtk_box_pack_start( GTK_BOX(hbox), widget , FALSE, FALSE, 0);
 gtk_widget_show(widget );

   /* View 3 */
 widget = gtk_radio_button_new_with_label( view_group, "3" );
 gtk_box_pack_start( GTK_BOX(hbox), widget , FALSE, FALSE, 0);
 gtk_widget_show(widget );

   /* View 4 */
 widget = gtk_radio_button_new_with_label( view_group, "4" );
 gtk_box_pack_start( GTK_BOX(hbox), widget , FALSE, FALSE, 0);
 gtk_widget_show(widget );

 gtk_table_attach_defaults (GTK_TABLE(table), hbox, 1, 4, 0, 1);
 gtk_widget_show( hbox );




-- 
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null



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