Re: modifying Gtk2::TreeIter contents




On Jul 4, 2008, at 8:23 PM, Kevin Ryde wrote:

I'm tinkering with a custom treemodel and thought to implement a
`remove' method behaving the same as the remove method of
Gtk2::ListStore.  That would mean modifying the given iter to refer to
the row after the one removed.  Is there a secret way to modify the
contents of a boxed-up Gtk2::TreeIter?

Not really. I think the trick is to bump your model's stamp to invalidate all existing iters and require the caller to acquire new ones. You can use a Path instead of an Iter to keep track of where you were (the Path is essentially a list of indices; if you remove 10, then 10 is now automatically pointing at what used to be the next one).

(I've said it a billion times before, but the iters are a major pain for bindings.)


--
Me:  What's that in your mouth?
Zella:  *swallows laboriously*  Nothing.
Me:  What did you just swallow?
Zella:  A booger.
Me:  Baby girl, don't eat boogers.  That's gross.
Zella:  But it was in my nose.




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