Radiobuttons dont work?



Hi,

I`ve a problem with Radiobuttons:
When I write the following code, the radiobutton array doesnt work, the middle buttons act like normal
togglebuttons if the first radiobutton is active, very strange:
#include <gtk/gtk.h>

void main(int argc, int *argv[]) {
  GSList * group;
  GtkWidget *window,*rb,*box;
  int i ;

  gtk_init(&argc, &argv);
  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  box = gtk_hbox_new(TRUE, 0);
for (i=1;i<=5;i++) {
      if (i==1) {
          rb = gtk_radio_button_new_with_label(NULL,"test123");
          group = gtk_radio_button_group(GTK_RADIO_BUTTON(rb));
      }
      else rb = gtk_radio_button_new_with_label(group,"test123");
      gtk_box_pack_start_defaults(GTK_BOX(box),GTK_WIDGET(rb));
  }
gtk_widget_show_all(box);
  gtk_container_add(GTK_CONTAINER(window),box);
  gtk_widget_show_all(window);
  gtk_main();
  return 0;
}

Where is my mistake? First I found this in gtk-1.3.5 but I could also reproduce it in the current stable version...


Thanks in advance,
                          Andre.






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