Re: TreeIters again

muppet wrote:
GtkTreeIter is designed to be very fast in C code, using stack
allocation and short object lifetimes.  This makes binding GtkTreeIter
to a dynamic language like perl rather, ahem, challenging, and
Gtk2::TreeIter is not very natural in perl.

Hmm, I see messages on gtk-app-devel-list discussing problems people are
having in C, so I'm not sure I entirely buy this :)  I couldn't see how
to do this operation in C either - it's not like I found a hole in the
Perl binding.

You can get a path from an iter, and you can convert a path to indices. 
You can build a path from indices.  From the docs:
    my $selected_index =
        ($tree_store->get_path ($selected_iter)->get_indices)[-1];

Thanks! This is what I've done.

There are iters, paths and indices; all of which could potentially be
used by themselves to manipulate a tree, but it turns out you have to
use all three together. Let's just say some other tree manipulation APIs
are easier to use.

BTW, I quickly skimmed the Python docs. Did I misunderstand or have they
somehow merged iters and paths?

Cheers, Dave

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