Problem with globals

From: Date: Mon, 28 Jan 2002 18:37:26 +0000
Subject: Problem with globals
Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-1051@lists.php.net to get a copy of this message
Hi all, I have a problem when using globals for gtk objects I have the following piece of code : function booba(){ global $debugwindow, $debugdata, $test; echo $test; $startstring = "Loging started @ " . date("r"); $debugdata->insert(NULL, NULL, NULL, $startstring); } class interface{ function open_debug(){ global $debugwindow, $debugdata, $test; $debugwindow = &new GtkWindow(); $debugwindow->set_default_size(800, 400); $debugwindow->connect('destroy', 'close_debug'); $debugwindow->connect('delete-event', 'close_debug'); $debugwindow->set_border_width(10); $debugwindow->set_title("--> SQAD MSN DeBug Window <--"); $test = "wappie"; $vbox = &new GtkVBox; $debugwindow->add($vbox); $debugdata = &new GtkText(); $scroller = &new GtkScrolledWindow; $scroller->set_policy(GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); $scroller->add($debugdata); $startstring = "Loging started @ " . date("r"); $debugdata->insert(NULL, NULL, NULL, $startstring); $vbox->pack_start($scroller, true, true, 10); $debugwindow->show_all(); gtk::timeout_add(200, "booba"); } function init(){ gtk::main(); } } After that i do this : $gui = new interface; $gui->open_debug(); $gui->init(); Then i nicely output "wappie" from the global var $test but i when i want to append text to the gtk-textwindows i get a error : wappie<br> <b>Fatal error</b>: Call to a member function on a non-object in <b>/gtk-core.msn</b> on line <b>79</b><br> So he says that the object doesn't exists. Maybe i do something wrong but i really don't no what's wrong. -- With kind regards, Met vriendelijke groet, Sander Aerts SQAD Visual Multi-Media Roerdomp 70 4872 PN Etten-Leur info@sqad.nl

« previous php.gtk.general (#1051) next »