Description Methods and Functions Hierarchy Interfaces Detailed Description Structures Convenient Construction Signals Properties Author(s) References
A choice from multiple check buttons
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)
1 2 3 4 5 6 7 8 9 10 | GObject
+----GInitiallyUnowned
+----GtkObject
+----GtkWidget
+----GtkContainer
+----GtkBin
+----GtkButton
+----GtkToggleButton
+----GtkCheckButton
+----GtkRadioButton
|
GtkRadioButton implements
AtkImplementorIface, GtkBuildable
and GtkActivatable
.
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 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.
GtkRadioButton
Contains only private data that should be read and manipulated using the functions below.
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.
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.
group
[GtkRadioButton
: * : Write]Sets a new group for a radio button.
Derived by RGtkGen from GTK+ documentation
https://developer.gnome.org/gtk2/stable/GtkRadioButton.html
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.