Re: problem with gtk_ctree_node_moveto()



>From the docs:

gtk_ctree_node_is_visible ()

GtkVisibility gtk_ctree_node_is_visible (GtkCTree *ctree, GtkCTreeNode *node);

  ctree :
   node :
Returns : True if the node is currently inside the bounds of the window. Note
that this function can return true even if the node is not viewable, if the
node's ancestor is visible.


So if your node has any visible ancestors, you will not get a return value of
GTK_VISIBILITY_NONE.

-Josh

Allin Cottrell wrote:
> 
> Hello,
> 
> I'm trying to modify the icon file selector in the gtkextra
> library so that the pre-selected directory (it's in a ctree)
> shows up in the middle of its scrolled window, but
> gtk_ctree_node_moveto() is not doing what I expected.
> 
> The gtkextra dir_tree (which is sub-classed from ctree) has been
> packed into the scrolled window thus:
> 
> gtk_container_add(GTK_CONTAINER(scrolled_window),
>                   filesel->dir_tree);
> 
> Now it comes time to display a directory, and there are two
> relevant pieces of code:
> 
> (1) gtk_ctree_select(GTK_CTREE(dir_tree), root_node);
> 
> This works fine: the specified directory is highlighted.
> 
> (2)
>    if (gtk_ctree_node_is_visible(GTK_CTREE(dir_tree), root_node)
>       == GTK_VISIBILITY_NONE)
>        gtk_ctree_node_moveto(GTK_CTREE(dir_tree), root_node, 0,
>                              0.5, 0.5);
> 
> But this doesn't work.  The scrollbars surrounding the ctree
> are adjusted "as if" to bring the root_node into view, but the
> view of the ctree itself remains at the top, and the selected
> node is not visible (you can find it by scrolling down).
> 
> Any suggestions?
> 
> Allin Cottrell.
> 
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list




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