Re: Can't add new widget to GtkFixed inside function
| From: | Steph Fox | Date: | Sat, 08 Apr 2006 11:29:47 +0000 |
| Subject: | Re: Can't add new widget to GtkFixed inside function | ||
| References: | 1 2 | Groups: | php.gtk.dev |
| Request: | Send a blank email to php-gtk-dev+get-2723@lists.php.net to get a copy of this message | ||
function DoStuff($fixed) {
$button2 = new GtkButton("Button 2");
$fixed->put($button2, 30, 40);
$fixed->show_all();
}
----- Original Message ----- From: "gell6" <spoongong@hotmail.com>
To: <php-gtk-dev@lists.php.net>
Sent: Saturday, April 08, 2006 1:13 PM
Subject: Re: [PHP-GTK-DEV] Can't add new widget to GtkFixed inside function
Just realised that if I take out the class and just use a plain old function,
the problem remains the same:
(again adding the line
MakeNewButton ($fixed);
in the main body will make the button appear, but still connect_simple won't
do it)
<?php
if (!class_exists('gtk')) { // standard gtk stuff
die("Please load the php-gtk2 module in your php.ini\r\n");
}
$wnd = new GtkWindow();
$wnd->set_title('MyApp');
$wnd->connect_simple('destroy', array('gtk', 'main_quit'));
$fixed = new GtkFixed ();
$button1 = new GtkButton("Button 1");
$fixed -> put($button1, 10, 10);
$button1 -> connect_simple ("clicked", "MakeNewButton", $fixed);
function MakeNewButton ($fixed) {
$button2 = new GtkButton("Button 2");
$fixed->put($button2, 30, 40);
}
$wnd->add($fixed); $wnd->show_all();
Gtk::main();
?>
--
View this message in context: http://www.nabble.com/Can%27t-add-new-widget-to-GtkFixed-inside-class-t1416282.html#a3817188
Sent from the Php - GTK - Dev forum at Nabble.com.
-- PHP-GTK Development Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
__________ NOD32 1.1380 (20060125) Information __________
This message was checked by NOD32 antivirus system.
http://www.eset.com