Re: trees and paths

From: Date: Tue, 23 Dec 2003 00:00:46 +0000
Subject: Re: trees and paths
References: 1  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-4309@lists.php.net to get a copy of this message
Dimitri, Well, I'm going thru my email-list archives, and it might be a bit late, but I've used $ctree->Node_Set_Row_Data() for a similar function to good success... http://gtk.php.net/manual/en/gtk.gtkctree.method.node_set_row_data.php Combine this with the children() function on http://gtk.php.net/manual/en/gtk.gtkctree.method.post_recursive.php and you have a mechanism for dealing with ctree without storing anything in a fancy hash or anything. I then call a recursive function defined something like Function GetStuff($ctree, $node=null, $return='') as in <? $data=GetStuff($ctree); ?> I use various means to actually SAVE the data in the $data variable, so I don't give the whole function. However, I've used $data[name]=$NameOfMemVariable; $data[data]=$ArrayOfData; $ctree->Node_Set_Row_Data($data); I hope this, along with the Print_Display() function I noted on http://gtk.php.net/manual/en/gtk.gtkctree.php proves to be helpful! -Ben On Tuesday 16 December 2003 01:04 am, Dimitri Giardina wrote: > another hint > > i'm writing a xml editor in php, using a ctree, a table for xml-node > attributes and a gtktext for cdata into nodes. for parse a xml file i'm > using xml_parser functions. > xml nodes are not labeled (i have no id for a node), and making path from > node types have not sense, i thought the better thing was: > > $obj=&$this->tree->insert_node($parent,Null,array($key),3,Null,Null,Null,Nu >ll,False,True); $this->key="KEY_".(++$this->datacounter); > $this->tree->set_data(serialize($obj),$this->key); > > the set_data is a access function (for all widgets) to a hash table. > > i think it's very useful, but it's very little documented. > > Dimitri Giardina

« previous php.gtk.general (#4309) next »