Re: [gtkmm] TreeView/TreeModel navigation

Am Sam, 2002-11-30 um 02.55 schrieb 3rdShift:
> I finally found it:
> there is a thing called TreePath object that is created by the TreeModel
> (and derivatives). TreePath is similar to TreeIter in the context of a
> ListStore with only difference that it behaves as a bi-directional
> iterator.

Gtk::TreePath is *not* an iterator -- it's important to understand
that.  It's an index just like std::vector<>::size_type that works with

> It has next() and prev() methods - all that I need to slide up
> and down the list. prev() returns bool - when it is false, you know you
> just hit the roof. Surprisingly, next() does not. 

That's because it's not an iterator but an index.  You can't go below
index 0.  In the other direction it's infinite.

> TreePath can also be converted to the row number by something like:
>    int row_num = atoi (TreePath::to_string ().c_str ());

I wouldn't use atoi() for that -- use get_indices().


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