Re: How to select a GtkCTree branch?



learfox furry ao net writes:

Hi.

How do I select a GtkCTree branch by code?  I tried gtk_ctree_select()
but it seems that I need one additional step to ensure that the selected
node branch is expanded.

How do I select and ensure that the branch is expanded (visible to the
user)?   This is for a find function where I have already found the
branch node pointer and want to select and ensure the user sees it.

Maybe you want something like this:

    if (gtk_ctree_node_is_visible(GTK_CTREE(tree), tnode)
        != GTK_VISIBILITY_FULL)
    {
        GtkCTreeNode *pnode;
        
        pnode = GTK_CTREE_ROW(tnode)->parent;
        while (pnode != NULL)
        {
            gtk_ctree_expand(GTK_CTREE(tree), pnode);
            pnode = GTK_CTREE_ROW(pnode)->parent;
        }
    }
    gtk_ctree_node_moveto(GTK_CTREE(tree), tnode, 0, 0, 0);
    gtk_ctree_select(GTK_CTREE(tree), tnode);


-- 
Michael Hussmann <m hussmann home ins de>      Why do we hide from the
http://home.pages.de/~m.hussmann            police dad? They use emacs 
f y cn rd ths y mst hv bn sng nx       son. We use vi. (Peter Gutmann)




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