Strange callback behaviour
| From: | Simon Gornall | Date: | Fri, 15 Mar 2002 12:00:45 +0000 |
| Subject: | Strange callback behaviour | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-1553@lists.php.net to get a copy of this message | ||
Hi all,
Ok, I may just have screwed this up - but it looks pretty odd, so just in
case:
The file javaInstaller.php is at http://www.gornall.net/javaInstaller.txt
rather than post it directly here - it's about 200 lines long. The crucial
parts are pretty basic though - the callback is attached to the class
function ok_cb() and gets called, sets $this->ok to 1, and calls
Gtk::main_quit(). So far so good :-)
The problem is that $this->ok is 0 when Gtk::main() exits! There are echo()
statements in the class wherever $this->ok is set/reset, and none of them
are unexpectedly called, so what's going on ? It's almost as though $this is
wrong! I'm confused :-(
Output looks like:
C:\installer>.\php -q -c . install.php
ok=0 (constructor,
expected)
Setting ok to 1 (callback,
expected)
Returning value of 0 (Huh!)
0 (from main
code)
... with the relevant part of install.php looking like:
$installer = new JavaInstaller($vm);
$ok = $installer->createUI($status);
echo $ok;