Re: gtk::timeout help
| From: | Andrei Zmievski | Date: | Fri, 23 Mar 2001 14:39:56 +0000 |
| Subject: | Re: gtk::timeout help | ||
| References: | 1 | Groups: | php.gtk |
| Request: | Send a blank email to php-gtk+get-1081@lists.php.net to get a copy of this message | ||
On Fri, 23 Mar 2001, Rich Payne wrote:
>
> So I've read through the archives on the use of gtk::timeout() and thought
> I had it figured out....can somebody tell me what I'm doing wrong
> here? I'm returning true, but it seems to then try to execute a function
> '1' (true) on the second call. Should I be returning the function name?
>
> <b>Warning</b>: Unable to call handler callback '1' specified in
> /home/richp/sysman/test/test.php on line 5 in <b>main.php</b> on line
> <b>9</b><br>
>
> (main.php just creates an instance of this class).
>
>
> <?php
>
> class testclass {
> function testclass() {
> gtk::timeout_add(1000,$this->test());
> }
>
> function test() {
> echo "Test message\n";
> return true;
> }
> }
You have to specify your callback like this:
gtk::timeout_add(1000, array($this, 'test'));
That's just how you have to specify object based callbacks in PHP.
-Andrei
"I still find each day too short for all the thoughts I want to think,
all the walks I want to take, all the books I want to read, and all the
friends I want to see."
-John Burroughs