Re: [PHP-GTK] Remove the nodes of a tree
[email protected] (kksou)
| Newsgroups | php.gtk.general |
|---|---|
| Message-ID | <[email protected]> |
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.