Part 11a

Gtk RadioButton

Creating the Glade File

  1. Start a Glade GtkBuilder project and save it as gtk11.glade.

  2. Add a main window.

  3. Add the on_window1_destroy handler to the GtkObject destroy signal and don’t forget to press enter so the handler sticks.

  4. Add a vertical box with 2 items.

  5. Add a horizontal box with 3 items in the top container.

  6. Add a radiobutton to each horizontal box containers.

  7. Add a label to the bottom container.

    Your project should look like this now.

    images/gtk-11-01.png
  8. Change the radiobuttons labels and names to rb1, rb2, rb3.

  9. Add the button_toggle handler to the GtkToggleButton Toggled signal for each button. You will have to type it in. Don’t forget to press the Enter key to make the handler take.

  10. Select rb3 and right click on the elipse next to Group: in the General tab. Then click on the radiobutton for rb1 to add rb3 to the rb1 group. You will notice that rb3 is now not selected as it is part of a group and only one button per group can be selected.

  11. Select rb2 and add it to the rb1 group.

    Your project should look like this now.

    images/gtk-11-02.png