Re: set_data

From: Date: Wed, 04 Dec 2002 09:05:10 +0000
Subject: Re: set_data
References: 1 2 3  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-2777@lists.php.net to get a copy of this message
while ($row=fetch_assoc($result)) { $groups[$row["aid"]] = $ctree->insert_node($categories[$row["category_aid"]], null, array($row["description"]),5, null, null, null,null, false,false); $groups[$row["aid"]]->set_data("aid",$row["aid"]); } The top level nodes in my tree are stored in an array $categories. The sub nodes are stored in $groups. This section of code loops through all the "groups" from my database and adds them to their parent "category". $row["aid"] is the ID number of the item from the database. The first line should store the GtkCTreeNode object into the array $groups[$row["aid"]]. The second line should then assign data to that object. But it doesn't work, apparently because CTreeNode's aren't objects that are accessible separately. Assigning data to TreeItem's works OK, so I am currently rewriting my code to work with normal Trees (I don't really need the columns). Unfortunately, Trees work very differently (and there isn't much documentation for them) and they seem to be heading for depreciation. Can anyone help me in assigning data to CTreeNodes? Actually, any other solution would work fine. Basically I just need to know the ID number (from the database) of the item that the user is clicking on in the tree. Using set_data seemed good in theory, but it is now proving more difficult than I thought. -------------------------------------- Andrew Smith The Blue Box Cape Town andrew@bluebox.co.za 021 683 6017 / 083 659 6106 ----- Original Message ----- From: "Steph" <sfox@php.net> To: "Andrew Smith" <andrew@bluebox.co.za>; <php-gtk-general@lists.php.net> Sent: Wednesday, December 04, 2002 4:02 AM Subject: Re: [PHP-GTK] set_data > could you please send the list a (short) script to explain what you did > there? > > (save me from going into one about how weird gtkctreenodes are ... > please ... ;) > > ----- Original Message ----- > From: "Andrew Smith" <andrew@bluebox.co.za> > To: <php-gtk-general@lists.php.net> > Sent: Tuesday, December 03, 2002 12:46 PM > Subject: [PHP-GTK] set_data > > > > Hello > > > > Why can set_data() be used on GtkListItem's, but not on > GtkCTreeNode's? I > > get an "undefined function" error. > > > > In the manual under the GtkCombo section it says: > > "Luckily, there are a trio of invaluable GtkObject methods that will > do just > > that, with any object and with any form of data. These are get_data() > , > > set_data() and remove_data()" > > > > Thanks > > > > -------------------------------------- > > Andrew Smith > > The Blue Box Cape Town > > andrew@bluebox.co.za > > 021 683 6017 / 083 659 6106 > > > > > > > > -- > > PHP-GTK General Mailing List (http://gtk.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > >

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