[Gtk-sharp-list] Keeping track of rows in sorted lists
Sun, 17 Oct 2004 15:23:28 -0700
On Sun, 2004-10-17 at 17:36 -0400, Peter Williams wrote:
> On Sun, 2004-10-17 at 17:03, Todd Berman wrote:
> > My recommendation is to store the actual data objects inside the
> > TreeModel.
> > you can do this like so: new TreeStore (typeof (Item));
> > and you can either use TreeCellDataFuncs to render, or store a string,
> > and then the Item.
> > That way when the string is sorted, your item is sorted with it.
> Hm. I don't think that really helps with what I want to do, which is map
> from TreeIter to Item. But I guess the real problem is that I'm trying
> to have my Item classes be the canonical storage location for the data
> for each row, but really the data in the TreeStore has to be the
> authoritative source.
Of course it helps, because Item item = ((TreeModel)model).GetValue (1,
iter) as Item; will return the item associated with that iter, and it
will get sorted with the string in column 0 of the TreeModel.
I believe however, that what you are looking for is using
TreeCellDataFuncs, and I'm not sure how those interact with sorting. The
whole TreeModel/sorting story is rather scary (to me at least).