Re: Cast Gtk::TreeModel::iterator to int
- From: Murray Cumming <murrayc murrayc com>
- To: Glus Xof <gtglus gmail com>
- Cc: gtkmm-list gnome org
- Subject: Re: Cast Gtk::TreeModel::iterator to int
- Date: Thu, 03 Dec 2009 08:46:03 +0100
On Wed, 2009-12-02 at 17:09 +0100, Glus Xof wrote:
> Honestly, I have seen the Gtk::TreeModel::Path::get_indices() method
> before, but I didn't consider it because I didn't know why the array
> of int(s), while I need just one int... Jose came again to give me
> light... because TreeStore nodes also exist...
>
> So,
>
> Glib::RefPtr <Gtk::ListStore> m_refTreeModel;
> Gtk::TreeModel::iterator iter;
> Gtk::TreeModel::Path cellpath=m_refTreeModel->get_path(iter);
> std::vector<gint> rowindex = cellpath.get_indices();
>
> The right value is rowindex[0]... ;)
>
> Thanks to all,
However, remember that this is almost never what you want:
- If you want some kind of numerical identifier for the item then you
should probably store that ID in an extra model column.
- If you want to refer to the row temporarily somehow, you should use
Gtk::TreeModel::iterator.
--
murrayc murrayc com
www.murrayc.com
www.openismus.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]