 |
| View previous topic :: View next topic |
| Author |
Message |
EmCee
Joined: 04 Aug 2006 Posts: 2
|
Posted: Fri Aug 04, 2006 12:24 am Post subject: Connecting a signal to an object fails |
|
|
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
|
Posted: Fri Aug 04, 2006 1:47 pm Post subject: Re: Connecting a signal to an object fails |
|
|
| 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
|
Posted: Fri Aug 04, 2006 6:22 pm Post subject: Re: Connecting a signal to an object fails |
|
|
| 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.. Thanks, anyway. |
|
| Back to top |
|
 |
ron_t
Joined: 11 Dec 2005 Posts: 78 Location: Gatineau, Quebec
|
Posted: Sat Aug 05, 2006 6:36 am Post subject: Re: Connecting a signal to an object fails |
|
|
| EmCee wrote: | One of those baby-mistakes, hum.. Thanks, anyway. |
No, no, don't think like that, dude. We've all been there. "Growing pains" is much more palatable.
-Ron T. |
|
| Back to top |
|
 |
|
|
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
|
|
 |