Re: GtkTreeView issues (porting from GtkCList)



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 ),
FALSE );

        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,
NULL, NULL ) )
        {
                gtk_tree_view_set_cursor
                        ( 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"
handling.

HTH

Jan-Marek



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