Re: Remove the nodes of a tree
| From: | kksou | Date: | Fri, 24 Aug 2007 16:25:52 +0000 |
| Subject: | Re: Remove the nodes of a tree | ||
| References: | 1 2 3 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-8059@lists.php.net to get a copy of this message | ||
Fernando Correa da Conceição-3 wrote:
> Thanks, but this is not exacty what I need...
> My case is that I do not want remove the
> parent node, only the childs.
>
> Fernando Correa da Conceição.
>
Try this then...
$parent_node = $model[$iter];
$nodes_to_remove = array();
foreach ($parent_node->children() as $child_node) {
$iter = $child_node->iter;
$nodes_to_remove[] = $model->get_string_from_iter($iter);
}
for ($i=count($nodes_to_remove)-1; $i>=0; --$i) {
unset($model[$nodes_to_remove[$i]]);
}
Complete sample code here:
http://www.kksou.com/php-gtk2/articles/remove-nodes-from-GtkTreeView---Part-3---remove-child-nodes-only.php
Regards,
/kksou
--
View this message in context: http://www.nabble.com/Remove-the-nodes-of-a-tree-tf4291296.html#a12315616
Sent from the Php - GTK - General mailing list archive at Nabble.com.