Re: Cast Gtk::TreeModel::iterator to int
- From: Glus Xof <gtglus gmail com>
- To: Murray Cumming <murrayc murrayc com>
- Cc: gtkmm-list gnome org
- Subject: Re: Cast Gtk::TreeModel::iterator to int
- Date: Thu, 3 Dec 2009 18:56:52 +0100
2009/12/3 Murray Cumming <murrayc murrayc com>:
> 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.
Thanks, Mr. Cumming, I'll bear in mind !!
Glus
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]