title: GTK+ How do I find which radio button is selected?
body: <p>The tutorial here <a href="http://developer.gnome.org/gtk-tutorial/2.90/x542.html" rel="noreferrer">http://developer.gnome.org/gtk-tutorial/2.90/x542.html</a>
  shows how to set up the radio buttons, but neglects to tell you how to use them. </p>
  
  <p>How do I then find which radio button is selected? </p>
  
  <p><strong>My solution:</strong></p>
  
  <p>Initialise radio buttons with:</p>
  
  <pre><code>rbutton1 = gtk_radio_button_new_with_label(NULL, "button1");
  gtk_box_pack_start(GTK_BOX(rbutton_box), rbutton1, TRUE, TRUE, 0);
  
  rbuttonGroup = gtk_radio_button_get_group(GTK_RADIO_BUTTON(rbutton1)); /*not sure what I'd use this line for currently though*/
  rbutton2 = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(rbutton1), "button 2"); 
  gtk_box_pack_start(GTK_BOX(rbutton_box), rbutton2, TRUE, TRUE, 0);
  
  rbutton3 = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(rbutton1), "button 3"); 
  gtk_box_pack_start(GTK_BOX(rbutton_box), rbutton3, TRUE, TRUE, 0);
  </code></pre>
  
  <p>And update a variable telling you which radio button is selected with this method:</p>
  
  <pre><code>        void checkRadioButtons()
  {
      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(rbutton1))==TRUE) selectedRadioButton =1;
      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(rbutton2))==TRUE) selectedRadioButton =2;
      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(rbutton3))==TRUE) selectedRadioButton =3;
  }
  </code></pre>