Re: GtkCTree : replacing a node with another node



On Mon, 2002-09-16 at 07:49, NavEcos wrote:
> I am trying to replace a node in a GtkCTree and I think I've found a
> bug.
> 
> I start with:
> 
> a = gtk_ctree_insert_node ( GTK_CTREE(gCtree), NULL, NULL,
>     pszArray, 0, NULL, NULL, NULL, NULL, FALSE, FALSE);
> b = gtk_ctree_insert_node ( GTK_CTREE(gCtree), a, NULL,
>     pszArray, 0, NULL, NULL, NULL, NULL, FALSE, FALSE);
> c = gtk_ctree_insert_node ( GTK_CTREE(gCtree), b, NULL,
>     pszArray, 0, NULL, NULL, NULL, NULL, FALSE, FALSE);
> 
> Which works fine to make a tree where a->b->c
> 
> 
> I want to replace b though, so I do the following:
> 
> /* remove old b */
> gtk_ctree_remove_node(GTK_CTREE(gCtree), b);
> 
> /* make new b */
> b = gtk_ctree_insert_node ( GTK_CTREE(gCtree), a, c,
>     pszArray, 0, NULL, NULL, NULL, NULL, FALSE, FALSE);
> 
> Which causes my application to crash, and if I reverse the order of the
> calls and I try:
> 
> /* make new b */
> newb = gtk_ctree_insert_node ( GTK_CTREE(gCtree), a, c,
>     pszArray, 0, NULL, NULL, NULL, NULL, FALSE, FALSE);
> 
> /* remove old b */
> gtk_ctree_remove_node(GTK_CTREE(gCtree), b);
> 
> 
> only "a" is displayed in the list and nothing beyond that.
> 
> Has anybody else ran into similar problems?
> 
> 
> I cannot seem to get ctk_ctree_insert_node to work when I specify a
> child, and it appears that gtk_ctree_remove_node deletes all it's
> children.  How do I remove JUST a single node?
> 
> Thanks,
> -Rich

The gtk_ctree_remove_node docs are pretty clear that it will remove the
node and all its children. Possibly you can accomplish what you want by
inserting the new node, using gtk_ctree_move to move the old nodes
children to the new node and then removing the old node.

-- 
regards,

Luciano Chavez

lnx1138 us ibm com          
http://evms.sourceforge.net




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]