man Gtk2::RadioButton () - Gtk2::RadioButton

NAME

Gtk2::RadioButton

SYNOPSIS

  # first group
  $foo1 = Gtk2::RadioButton->new (undef, 'Foo One');
  $foo2 = Gtk2::RadioButton->new ($foo1, 'Foo Two');
  $foo3 = Gtk2::RadioButton->new ($foo2, 'Foo Three');

  # second group, using the group reference
  $bar1 = Gtk2::RadioButton->new (undef, 'Bar One');
  $group = $bar1->get_group;
  $bar2 = Gtk2::RadioButton->new ($group, 'Bar Two');
  $bar3 = Gtk2::RadioButton->new ($group, 'Bar Three');

  # move bar3 from the bar group to the foo group.
  $bar->set_group ($foo->get_group);

  # iterate over the widgets in the group
  $group = $foo1->get_group;
  foreach my $r (@$group) {
      $r->set_sensitive ($whatever);
  }

DESCRIPTION

A single radio button performs the same basic function as a Gtk2::CheckButton, 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 Gtk2::RadioButton is one way of giving the user a choice from many options; Gtk2::OptionMenu and Gtk2::ComboBox (added in gtk+ 2.4) are alternatives.

Each constructor can take either a group or widget from that group where the group is wanted; this is an enhancement over the C API. Nevertheless, the _from_widget forms are provided for completeness.

HIERARCHY

  Glib::Object
  +----Glib::Object::_Unregistered::GInitiallyUnowned
       +----Gtk2::Object
            +----Gtk2::Widget
                 +----Gtk2::Container
                      +----Gtk2::Bin
                           +----Gtk2::Button
                                +----Gtk2::ToggleButton
                                     +----Gtk2::CheckButton
                                          +----Gtk2::RadioButton

INTERFACES

  Gtk2::Atk::ImplementorIface

METHODS

Create a radio button. If $label is provided, it will be interpreted as a mnemonic. If $member_or_listref is undef, the radio button will be created in a new group. Create a radio button with a plain text label, which will not be interpreted as a mnemonic. Create a radio button with a mnemonic; this is an alias for CWnew. Return a reference to the radio group to which $radio_button belongs. The group is a reference to an array of widget references; the array is not magical, that is, it will not be updated automatically if the group changes; call CWget_group each time you want to use the group.

$radio_button->set_group ($member_or_listref)

Assign $radio_button to a new group.

PROPERTIES

'group' (Gtk2::RadioButton : writable / private)
The radio button whose group this widget belongs to.

SIGNALS

group-changed (Gtk2::RadioButton)

SEE ALSO

Gtk2, Glib::Object, Glib::Object::_Unregistered::GInitiallyUnowned, Gtk2::Object, Gtk2::Widget, Gtk2::Container, Gtk2::Bin, Gtk2::Button, Gtk2::ToggleButton, Gtk2::CheckButton

COPYRIGHT

Copyright (C) 2003-2005 by the gtk2-perl team.

This software is licensed under the LGPL. See Gtk2 for a full notice.