[nycphp-talk] [ PHP-GTK ] - Button Callbacks Not Working
Scott Mattocks
scott at crisscott.com
Mon Oct 18 08:22:35 EDT 2004
Neither the mailing list nor the IRC chat are dead. The irc is just
really quiet. (You can usually find someone to help there 9-5 EST)
That error means that you are trying to stop the main gtk loop but it
isn't running. The problem is that your call to connect is wrong. The
connect method takes two strings as arguments but your second argument
in your button class is executing a function and passing back the
functions return value. You are executing the gtk::main_quit() method
and using the return value (NULL) as the name of the function to connect
the signal to. That is why you get the warning about connecting to the
callback ''. The Gtk-CRITICAL warning comes from the fact that you tried
to execute the gtk::main_quit() method before executing the gtk::main()
method.
On a side note, whenever you pass a PHP-GTK widget to/from a method you
need to do it with references. Otherwise you are making a copy of the
object and you are adding the copy to window (or other container). Then
what you think is pointing to your button in your window is really
pointing to the original button that you created which is still floating
around in space.
I hope that helps.
Scott Mattocks
Joseph Crawford wrote:
> Guys i am starting to learn php-gtk and i am having a bit of a
> problem, when i click my button the Actions::destroy() method is not
> called for the callback.
>
> here are the errors i get when i run the app and click the button
>
> [idle at vt-fairhaven1a-82 irc-php]$ php irc.php
>
> Gtk-CRITICAL **: file gtkmain.c: line 582 (gtk_main_quit): assertion
> `main_loops != NULL' failed.
>
> Warning: Unable to call signal callback '' specified in
> /home/idle/irc-php/class/button.class.php on line 9 in
> /home/idle/irc-php/irc.php on line 15
More information about the talk
mailing list