Re: Problems with libGlade

From: Date: Tue, 16 Oct 2001 18:37:58 +0000
Subject: Re: Problems with libGlade
References: 1  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-292@lists.php.net to get a copy of this message
On Tue, 16 Oct 2001, PQ Administrator wrote: > > First off, great work guys, PHP-GTK+LibGlade rocks! > > However, im having some touble getting data to pass from GtkButton event 'clicked' to > my function to process the two entry fields the code is as follows: > > <?php > > function do_login($button1, $entry1) { > > $uid = $entry1->get_text(); > $passwd = $entry2->get_text(); > > Print "Username is: $uid\n"; > Print "Password is: $passwd\n"; > > > } > > dl( 'php_gtk.' . (strstr(PHP_OS, 'WIN') ? 'dll' : > 'so')); > > $gx = &new GladeXML('c:\phpgtk\test\test.glade'); > > $gx->signal_autoconnect(); > > Gtk::main(); > ?> > > When i create UI in Glade i set the two text entry boxes named: entry1 and entry2. > The buttons are then set with the signal, clicked and the do_login method. > > What i cant figure out is where do i put the entry1 and entry2 variables to pass the data to my > function as parameters You can't use Glade to pass PHP variables around. :) You need to do something like this: $gx = &new GladeXML('c:\phpgtk\test\test.glade'); $entry1 = $gx->get_widget('entry1'); $entry2 = $gx->get_widget('entry2'); $gx->signal_autoconnect('do_login' => array('do_login', $entry1)); -Andrei "Later in this talk, I intend to define the universe and give three examples." -- Larry Wall

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