Try this class based example. Hope you'll enjoy.
<?php
if( !extension_loaded('gtk')) {
dl( 'php_gtk.' . PHP_SHLIB_SUFFIX);
}
class c_win extends GtkWindow
{
function __construct($parent = null)
{
parent::__construct();
$this->connect("destroy", "shutdown");
$this->set_border_width(10);
$this->set_default_size(-1,500);
$this->add($this->_Box());
$this->show_all();
}
function _Box()
{
$box = new GtkHBox();
$fram_horiz = new GtkFrame("New Horizontal Button");
$box->pack_start($fram_horiz,true,true,10);
$button = &new GtkButton("Click Me!");
$button->connect("clicked",array($this,"button_clicked"));
$fram_horiz->add($button);
return $box;
}
function shutdown()
{
print("Shutting down...\n");
gtk::main_quit();
}
function button_clicked()
{
$window = &new GtkWindow();
$label = &new GtkLabel("You clicked the button");
$window->add($label);
$window->connect("destroy",array($this,"shutdown"));
$window->show_all();
return false;
}
}
$win = new c_win();
Gtk::main();
?>
http://gtk.php.net:80/manual/en/signals.connection.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.