Re: Getting indexes of row's children in treeview



If I'm reading your question correctly, you're looking for path.up() and path.down() to change levels in the tree, and path.next() and path.prev() to change nodes within a level. Continuing your example and assuming iter points to row 3,

    cout << path.to_string() << endl; // 3
    path.down();
    cout << path.to_string() << endl; // 3:0
    path.next();
    cout << path.to_string() << endl; // 3:1
    path.down();
    cout << path.to_string() << endl; // 3:1:0
    ...

On 2016/06/28 09:22, Kamalpreet Grewal wrote:
Hi

I have been trying to get the index value of rows in a treeview. I did it using:

path = _tree.get_model()->get_path(iter);
int i = atoi(path.to_string().c_str());

This works well by storing selected row's index in 'i'. Next I have
children in these rows and I wish to get the index of the child of a
row selected.

And I came across: http://scentric.net/tutorial/sec-treemodel-rowref.html
How the indexes are assigned at different depths in a treeview is
well-explained at this link in the beginning only.

Obtaining these indexes in the form "0:1" etc has been an issue for
me. How can this be done? Are there any alternatives to get indexes of
children of rows?

Thanks in advance.



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