note 624 added to signals.connection.php
| From: | chauhansudhir at gmail dot com | Date: | Fri, 24 Mar 2006 01:16:46 +0000 |
| Subject: | note 624 added to signals.connection.php | ||
| Groups: | php.gtk.webmaster | ||
| Request: | Send a blank email to php-gtk-webmaster+get-2942@lists.php.net to get a copy of this message | ||
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