PHP4 Object Issues.
| From: | Piero B. Contezini | Date: | Tue, 02 Aug 2005 19:18:17 +0000 |
| Subject: | PHP4 Object Issues. | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-6118@lists.php.net to get a copy of this message | ||
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?