<?php
// Say 'hi' on the terminal
function sayHi()
{
echo 'Hi';
}
// Make a button shut up.
function beQuiet(&$button, $handler)
{
$button->disconnect($handler);
}
// Set up the window
$window =& new GtkWindow;
$hBox =& new GtkHBox;
// Make a button that says hi.
$button1 =& new GtkButton('Say Hi');
$handler = $button1->connect('clicked', 'sayHi');
// Make the first button shut up when the second is clicked.
$button2 =& new GtkButton('Be Quiet!');
$button2->connect_object('clicked', 'beQuiet', $button1, $handler);
$hBox->pack_start($button1);
$hBox->pack_start($button2);
$window->add($hBox);
$window->show_all();
gtk::main();
?>
|