gnope php gtk gui gnope.org  

Connecting a signal to an object fails

 
Post new topic   Reply to topic    gnope.org Forum Index -> PHP GTK2 Beginners
View previous topic :: View next topic  
Author Message
EmCee



Joined: 04 Aug 2006
Posts: 2

PostPosted: Fri Aug 04, 2006 12:24 am    Post subject: Connecting a signal to an object fails Reply with quote

Hello.

I have an object which generates and manages a GtkWindow. To prevent deletion and hide the window on delete_event, I tried to connect the delete_event signal to the function $this->guiWindowHide. This failed throwing the error message "Warning: Unable to invoke signal callback 'TeamOrga::guiWindowHide' specified in D:\...\main.php on line 153 in D:\...\main.php on line 50".
My code was $window->connect_simple('delete_event', array($this, 'guiWindowHide'));. So next I tried the same with gtk::true (array('gtk', 'true')) but it failed throwing the same error message.
When using an simple function like $window->connect_simple('delete_event', 'func_that_returns_true'); it works.
So, am I doing something wrong or is it simply a bug which is not yet fixed in PHP-GTK2?
Back to top
ron_t



Joined: 11 Dec 2005
Posts: 78
Location: Gatineau, Quebec

PostPosted: Fri Aug 04, 2006 1:47 pm    Post subject: Re: Connecting a signal to an object fails Reply with quote

EmCee wrote:
Hello.

I have an object which generates and manages a GtkWindow. To prevent deletion and hide the window on delete_event, I tried to connect the delete_event signal to the function $this->guiWindowHide. This failed throwing the error message "Warning: Unable to invoke signal callback 'TeamOrga::guiWindowHide' specified in D:\...\main.php on line 153 in D:\...\main.php on line 50".

My code was $window->connect_simple('delete_event', array($this, 'guiWindowHide'));.


Assuming that this line of code and the method you're trying to hook up are both inside the object, it should work. You might double-check the spelling for your method name (obvious, I know, but possible). Failing that, you may have to post a little more actual code before we can see what's going on.

-Ron T.
Back to top
EmCee



Joined: 04 Aug 2006
Posts: 2

PostPosted: Fri Aug 04, 2006 6:22 pm    Post subject: Re: Connecting a signal to an object fails Reply with quote

ron_t wrote:
You might double-check the spelling for your method name (obvious, I know, but possible).

Not exactly that mistake, but nearly. I have declared the callback function as private, so it couldn't work. Now I declared it to be public and everything works fine. One of those baby-mistakes, hum.. Sad Thanks, anyway.
Back to top
ron_t



Joined: 11 Dec 2005
Posts: 78
Location: Gatineau, Quebec

PostPosted: Sat Aug 05, 2006 6:36 am    Post subject: Re: Connecting a signal to an object fails Reply with quote

EmCee wrote:
One of those baby-mistakes, hum.. Sad Thanks, anyway.


No, no, don't think like that, dude. We've all been there. "Growing pains" is much more palatable.

Very Happy

-Ron T.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    gnope.org Forum Index -> PHP GTK2 Beginners All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Templates enhanced by DigiWiki. Hosting by Tradebit.