RE: [PHP-GTK] Using Glade with PHP-GTK

From: Date: Sat, 15 Nov 2003 20:45:35 +0000
Subject: RE: [PHP-GTK] Using Glade with PHP-GTK
References: 1  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-4152@lists.php.net to get a copy of this message
Actually I have it sort of working now. However, when I run the PHP script from the command line, this application window shows up and then disappears right away. It just flashes once and that's it. Here is the code I'm using: <?php $xml = "c:/php4/test/test/test.glade"; if (!class_exists('gtk')) { if (strtoupper(substr(PHP_OS, 0,3) == 'WIN')) { dl('php_gtk.dll'); } else { dl('php_gtk.so'); } } function open_window($name) { global $xml; $gx = &new GladeXML($xml, $name); $gx->signal_autoconnect(); return $gx; } function on_button_clicked() { echo "Clicked\n"; } $window = open_window("windowMain"); ?> Can you give me some suggestions on what to do? Thanks, Matt -----Original Message----- From: James Cameron [mailto:quozl@us.netrek.org] Sent: Saturday, November 15, 2003 5:01 AM To: php-gtk-general@lists.php.net Subject: Re: [PHP-GTK] Using Glade with PHP-GTK Yes, it could be misleading. Glade doesn't have a code generator for PHP, instead your PHP code is expected to load the XML file that Glade uses as the project file. Your PHP code might look this; # utility functions, instantiate a window from widget tree function open_window($name) { global $xml; $gx = &new GladeXML($xml, $name); $gx->signal_autoconnect(); return $gx; } Where $xml is the file name of the XML file, whatever.glade, and $name is the top level widget to be displayed. http://quozl.netrek.org/pptp/php-gtk/ has an example, in case you want to see how it works. -- James Cameron mailto:quozl@us.netrek.org http://quozl.netrek.org/ -- PHP-GTK General Mailing List (http://gtk.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

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