Re: TreeModel selected row number



On Tue, 2005-03-22 at 03:30 -0700, John Taber wrote:
> I cannot seem to figure out how to get the selected row number in a tree 
> model.  I am following the example framework and have:
> 
> Gtk::TreeModel::iterator iter = m_refTreeModel->get_iter(path);
> if(iter) {Gtk::TreeModel::Row row = *iter;}
> 
> this gives me the "Row" and I can get any member of that row and I guess I 
> could use a member value and iterate thru the data to find the row number but 
> that seems the hard way - what am I missing ?  
> thks

Yes, I think it's that difficult. But the row number should not be
useful anyway, because the TreeModel is iterator based. It's the same as
wanting to get the numerical index of a std::list. 

You might parse the Path after converting the iterator to the path. It's
probably very slow though.

If what you actually want is some identifier for the data in the column,
then just store an extra hidden ID column in the model.

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




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