Re: GtkMenu ?
| From: | Andrei Zmievski | Date: | Mon, 16 Jul 2001 19:14:51 +0000 |
| Subject: | Re: GtkMenu ? | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.gtk |
| Request: | Send a blank email to php-gtk+get-2223@lists.php.net to get a copy of this message | ||
On Mon, 16 Jul 2001, Jonas Delfs wrote:
> Okay - that may be the solution, then. Though it doesnt seem very optimal.
> I hope you will follow me all the way:
> <br>
> <b>Fatal error</b>: Call to a member function on a non-object in
> <b>c:\backup\PROGRA~1\php-gtk\edit4-f\edit4-f.php</b> on line
> <b>82</b><br>
>
> Line 82 looks like this:
>
> $this->gui['notebook']->append_page(&$this->gui['textarea'],
> &$this->gui['label']);
>
> And the definition of $this->gui['notebook'] looks like this:
>
> $this->gui['notebook'] = &new GtkNotebook;
>
> - and it IS defined when i call append_page(), so what can the problem be?
The problem is that you pass $this by value instead of by reference in
the array($this, 'newFileInst'). By the time you define item factory, your
$this->gui['notebook'] is not yet defined, and since you didn't pass by
reference PHP made a copy of the object. Try using array(&$this,
'newFileInst').
-Andrei
* We reason deeply, when we forcibly feel. *