Re: Open the same window when i push a button in a gtkwindow
| From: | Antonini Massimiliano | Date: | Thu, 05 Aug 2004 15:45:14 +0000 |
| Subject: | Re: Open the same window when i push a button in a gtkwindow | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-4935@lists.php.net to get a copy of this message | ||
Thanks a lot . This kind of approach like me too much........
Here the complete code......
<?php
class Application{
var $primaryWindow;
var $secondaryWindow;
var $firstButton;
var $gtkFixed;
function Application(){
$this->primaryWindow = &new GtkWindow();
$this->primaryWindow->set_title("Test App");
$this->primaryWindow->set_usize(400, 250);
$this->primaryWindow->set_position(GTK_WIN_POS_CENTER);
$this->primaryWindow->set_policy(false, false, false);
$this->primaryWindow->connect_object("destroy", array('gtk',
'main_quit'));
$this->gtkFixed = &new GtkFixed();
$this->firstButton = &new GtkButton('Show Second Window');
$this->firstButton->connect_object('clicked', array(&$this,
'button_clicked'));
$this->gtkFixed->put($this->firstButton, 35, 50);
$this->primaryWindow->add($this->gtkFixed);
$this->primaryWindow->show_all();
}
function button_clicked(){
if(!isset($this->secondaryWindow)){
$this->secondaryWindow = &new GtkWindow();
$this->secondaryWindow->set_title("Seconda");
$this->secondaryWindow->set_usize(400, 250);
$this->secondaryWindow->set_position(GTK_WIN_POS_LEFT);
$this->secondaryWindow->set_policy(false, false, false);
$this->secondaryWindow->connect_object("destroy", array(&$this,
'kill_secondary_window'));
$this->secondaryWindow->show_all();
}
}
function kill_secondary_window(){
unset($this->secondaryWindow);
}
}
// Load the PHP-GTK extension
$extension = "php_gtk" . (strpos(PHP_OS, "WIN") >= 0 ? ".dll" :
".so");
dl($extension);
$class = new Application();
gtk::main();
?>