Learn R Programming

RGtk2 (version 2.20.31)

GtkRadioButton: GtkRadioButton

Description

A choice from multiple check buttons

Arguments

Methods and Functions

gtkRadioButtonNew(group = NULL, show = TRUE) gtkRadioButtonNewFromWidget(group = NULL, show = TRUE) gtkRadioButtonNewWithLabel(group = NULL, label, show = TRUE) gtkRadioButtonNewWithLabelFromWidget(group = NULL, label, show = TRUE) gtkRadioButtonNewWithMnemonic(group, label, show = TRUE) gtkRadioButtonNewWithMnemonicFromWidget(group = NULL, label, show = TRUE) gtkRadioButtonSetGroup(object, group) gtkRadioButtonGetGroup(object) gtkRadioButton(group = NULL, label, show = TRUE)

Hierarchy

GObject
   +----GInitiallyUnowned
         +----GtkObject
               +----GtkWidget
                     +----GtkContainer
                           +----GtkBin
                                 +----GtkButton
                                       +----GtkToggleButton
                                             +----GtkCheckButton
                                                   +----GtkRadioButton

Interfaces

GtkRadioButton implements AtkImplementorIface, GtkBuildable and GtkActivatable.

Detailed Description

A single radio button performs the same basic function as a GtkCheckButton, as its position in the object hierarchy reflects. It is only when multiple radio buttons are grouped together that they become a different user interface component in their own right. Every radio button is a member of some group of radio buttons. When one is selected, all other radio buttons in the same group are deselected. A GtkRadioButton is one way of giving the user a choice from many options. Radio button widgets are created with gtkRadioButtonNew, passing NULL as the argument if this is the first radio button in a group. In subsequent calls, the group you wish to add this button to should be passed as an argument. Optionally, gtkRadioButtonNewWithLabel can be used if you want a text label on the radio button. Alternatively, when adding widgets to an existing group of radio buttons, use gtkRadioButtonNewFromWidget with a GtkRadioButton that already has a group assigned to it. The convenience function gtkRadioButtonNewWithLabelFromWidget is also provided. To retrieve the group a GtkRadioButton is assigned to, use gtkRadioButtonGetGroup. To remove a GtkRadioButton from one group and make it part of a new one, use gtkRadioButtonSetGroup. The group list does not need to be freed, as each GtkRadioButton will remove itself and its list item when it is destroyed. How to create a group of two radio buttons.
# Creating two radio buttons
create_radio_buttons <- function() { window <- gtkWindow("toplevel", show = F)
  box <- gtkVBoxNew(TRUE, 2) ## Create a radio button with a GtkEntry widget 
  radio1 <- gtkRadioButton()
  entry <- gtkEntry()
  radio1$add(entry) ## Create a radio button with a label
  radio2 <- gtkRadioButtonNewWithLabelFromWidget(radio1,
                                                 "I'm the second radio button.") ## Pack them into a box, then show all the widgets
  box$packStart(radio1, TRUE, TRUE, 2)
  box$packStart(radio2, TRUE, TRUE, 2)
  window$add(box)
  window$showAll()
}
When an unselected button in the group is clicked the clicked button receives the "toggled" signal, as does the previously selected button. Inside the "toggled" handler, gtkToggleButtonGetActive can be used to determine if the button has been selected or deselected.

Structures

Convenient Construction

gtkRadioButton is the result of collapsing the constructors of GtkRadioButton (gtkRadioButtonNew, gtkRadioButtonNewFromWidget, gtkRadioButtonNewWithLabel, gtkRadioButtonNewWithLabelFromWidget, gtkRadioButtonNewWithMnemonic, gtkRadioButtonNewWithMnemonicFromWidget) and accepts a subset of its arguments matching the required arguments of one of its delegate constructors.

Signals

Properties

References

http://library.gnome.org/devel//gtk/GtkRadioButton.html