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

From: Date: Sun, 16 Nov 2003 12:24:43 +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-4154@lists.php.net to get a copy of this message
To use GladeXML you need the xml library in your PHP. El sáb, 15 de 11 de 2003 a las 21:45, Matt Palermo escribió: > 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 (#4154) next »