Re: GtkTreeView issues (porting from GtkCList)

I was trying to port a GTK1 app toward a GTK2 app. In my GTK1 app I
was using a CTree and I had to implement a TreeView in my GTK2 app to
show my old tree.

I have two questions:

1) There is a way to set the root of the tree?
    > child 1
    > child 2

What I want is: in this example, I could not move the child 1 or the
child 2 to the root position! The root will always be the ROOT of the

2) There is a way to select when a node will be a leaf or a node?


On 6/14/05, Jan-Marek Glogowski <glogow fbihome de> wrote:
Hi Yury

Yury Aliaev wrote:

2) When pressing the left mouse button and moving the cursor vertically
the selection in GtkCList follow the cursor. In GtkTreeView -- not. How
can I obtain in GtkTreeView the same behavior as in GtkCList?

Not the same problem, but you may be able to adapt my solution:

gtk_widget_add_events( ect->treeview, GDK_POINTER_MOTION_MASK );

g_signal_connect( ect->treeview, "motion-notify-event",
                G_CALLBACK( editor_clist_hover_event ), ect );

static gboolean editor_clist_hover_event
        ( GtkWidget *widget, GdkEventMotion *event, gpointer user_data )
        EditorClistTimestamps *ect;
        GtkTreeView *tree_view;
        GtkTreePath *path;
        GtkTreeViewColumn *focus_column;

        g_return_val_if_fail( user_data != NULL, FALSE );
        g_return_val_if_fail( IS_EDITOR_CLIST_TIMESTAMPS( user_data ),

        ect = EDITOR_CLIST_TIMESTAMPS( user_data );
        tree_view = GTK_TREE_VIEW( ect->treeview );

        if( gtk_tree_view_get_path_at_pos( tree_view,
                (gint) event->x, (gint) event->y, &path, &focus_column,
                        ( tree_view, path, focus_column, FALSE );
                gtk_tree_path_free( path );
        return FALSE;

You also need to write a button press event handler, to toggle the "hover"


gtk-app-devel-list mailing list
gtk-app-devel-list gnome org

André Pedralho
Bachelor in Computer Science
Instituto Nokia de Tecnologia

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