Re: Q: How to get selected tree iter's index?



On Tuesday 11 November 2003 03:42, Shorn Mo / Partner Tech.(Shanghai) Co., 
Ltd. wrote:

I can get selected GtkTreeIter from GtkTreeView, but I must know the index
number of selected row.

Does Path Depth means index number?

you want the path indices, or, more precisely, something like this:

gint  depth,  *indices, idx;

depth   = gtk_tree_path_get_depth(path);
indices = gtk_tree_path_get_indices(path);

g_assert(depth > 0); /* depth 0 = invisible root of the tree view */

idx = indices[depth-1];

That gives you the 'n' as in 'the n-th child of the parent node' that this row 
is (if that's what you wanted).

Cheers
-Tim






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