Re: PHP4 Object Issues.
| From: | Malk0 | Date: | Tue, 02 Aug 2005 20:45:54 +0000 |
| Subject: | Re: PHP4 Object Issues. | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-6121@lists.php.net to get a copy of this message | ||
as i can see thoose function are class methods,
if they are used as callback or eventhandler perhaps you've forgotten
an & in the callback assignation.
you must declare callback in this way when using class :
this->ctree->connect('signal',array(&$this,'callback_method'));
not sure that is your problem but hope it can help.
regards nathan
2005/8/2, Piero B. Contezini <piero@grupoamerican.com.br>:
> I know it is not a question to be placed here, but with GTK we really
> use all the advanced procedures of PHP, in other places most people dont
> even know its possible to do.
>
> The problem is:
>
> I have a object variable that stores the current selected node of a
> Ctree Object, whenever a user clicks on it, the node is stored.
> Somewhere in the program, I need to add a new field, and i use the node
> as the parent node for the new one.
> The problem i'm having is about crossing objects thru the execution
> flow, and using a object variable from a function within this object,
> but being called from outside. The variable in question appear to be
> null, the code exemple shows my problem:
>
> The Function atached to the select event:
>
> function selecionar($node, $id) {
> global $projeto;
> $data = $this->ctree->node_get_row_data($node);
> $this->node_selecionado = $node; // this is the variable i need
> to store
> }
>
> The Function that uses this variable:
>
> function add_toolbox($objeto) {
> $objptr =
> $this->ctree->insert_node($this->node_selecionado,null,array("N",$objeto
> ->nome,$tipo),0,null,null,null,null,false,false);
>
> $this->ctree->node_set_row_data($objptr,array($this->objeto_pai,$objeto)
> );
> }
>
> Here, the variable is ALWAYS null, but when i print it from other
> function it is ok, anyone had this problem before?
>
> The function add_toolbox is called always from a main object, this two
> functions are from a object called toolbox, so they would be able to
> share this variable.
>
> Thanks
>
> Piero
>
> Obs: Maybe php has context issues with objects?
>
> --
> PHP-GTK General Mailing List (http://gtk.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>