GtkRadioButton {RGtk2} | R Documentation

## GtkRadioButton

### Description

A choice from multiple check buttons

### 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

`GtkRadioButton`

  Contains only private data that should be read and manipulated using the functions below.

### 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

`group-changed(style, user.data)`

  Emitted when the group of radio buttons that a radio button belongs to changes. This is emitted when a radio button switches from being alone to being part of a group of 2 or more buttons, or vice-versa, and when a button is moved from one group of 2 or more buttons to a different one, but not when the composition of the group that a button belongs to changes. Since 2.4

  `style`

    the object which received the signal

  `user.data`

    user data set when the signal handler was connected.

### Properties

`group` [`GtkRadioButton` : * : Write]

  Sets a new group for a radio button.

### Author(s)

Derived by RGtkGen from GTK+ documentation

### References

https://developer.gnome.org/gtk2/stable/GtkRadioButton.html

[Package RGtk2 version 2.20.36.3 Index]