GtkRadioButton Constructor

GtkRadioButton ( GtkRadioButton group , string label);

The first GtkRadioButton in a group should have the first parameter set to null. This 'group leader' is not attached to anything; there is not at present such a thing as a GtkGroup widget of any kind.

All subsequent GtkRadioButton widgets belonging to the same group should have the variable representing that group leader as the first parameter.

Ejemplo 34. Constructing a group of radio buttons

<?php

dl('php_gtk.' . (strstr(PHP_OS, 'WIN') ? 'dll' : 'so'));

function here_goes($button) {
  $child = $button->child;
  echo $child->get()."\n";
}

$window = &new GtkWindow();
$window->connect_object('destroy', array('gtk', 'main_quit'));
$window->set_title('GtkRadioButton demo');

$box = &new GtkVBox();
$window->add($box);

$button1 = &new GtkRadioButton(null, 'button 1');
$button1->connect('pressed', 'here_goes');
$box->pack_start($button1);

for ($i = 2; $i <= 4; $i++) {
  $button = &new GtkRadioButton($button1, 'button ' . $i);
  $button->connect('pressed', 'here_goes');
  $box->pack_start($button);
}

$button_end = &new GtkButton('Exit');
$button_end->connect_object('clicked', array('gtk', 'main_quit'));
$box->pack_end($button_end);

$window->show_all();

gtk::main();

?>