RE: How to get Position of GtkTreeIter?



 Later i have a callback ("changed") that takes action if a
 user of my app selected e.g. the 17'th entry in this list
 fiew that is position 16 (begin of count=0). But callback
 function don't know about this 17'th position. Now, how can i
 get this position?
 
 I'm searchig for a function like "gtk_list_view_get_position()"
 in cooperation with gtk tree selection mode (value that we'll
 get by calling gtk_tree_view_get_selection(); ). Is anybody
 here who knows about such possibility?

I think to do this you will have to use:

        GtkTreeIter iter;
        GtkTreePath *path = NULL;
        gint *indices;
        const gint level = 0;

        path = gtk_tree_model_get_path(model, &iter)
        indices = gtk_tree_path_get_indices(path);

        printf("row index is:%d at tree level:%d\n", indices[level], level);

        /* clean up */
        gtk_tree_path_free(path);


As you can see, you need to get the path, then use the get_indices function.
The level is not relevant for a straight forward list as it represents the
depth that you are interested, and simple lists have only one depth.

Regards,
Martyn



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