On 08/19/2010 01:34 PM, Rampage wrote: > i've adapted your snipplet to work in the testcollapse, and it works > great, it removes all child nodes. > the problem is that once all children are deleted i can't add anything > anymore, couse it looks like the iter goes lost, and without the dummy > value i can't test expansion anymore to trigger the population event.
My understanding (someone correct me if I'm wrong) is that the only iter that is guaranteed to be valid is the one you're working on when you mutate the tree. Therefore the original node's iter will be invalid after the first call to Remove(). To work around this, consider inserting your dummy node into the list of child notes, right at the front. Then call IterNext on that iter to get the first child to remove, then proceed as normal. So, do something like this instead: TreeIter node = GetIterBeingCollapsed(); int depth = model.IterDepth(node); TreeIter dummy = model.InsertNode(node, 0); // set values on dummy... if (model.IterNext(ref dummy)) { while (model.IterDepth(dummy) > depth && model.Remove(ref dummy)); } -- Chris Howie http://www.chrishowie.com http://en.wikipedia.org/wiki/User:Crazycomputers If you correspond with me on a regular basis, please read this document: http://www.chrishowie.com/email-preferences/ PGP fingerprint: 2B7A B280 8B12 21CC 260A DF65 6FCE 505A CF83 38F5 ------------------------------------------------------------------------ IMPORTANT INFORMATION/DISCLAIMER This document should be read only by those persons to whom it is addressed. If you have received this message it was obviously addressed to you and therefore you can read it. Additionally, by sending an email to ANY of my addresses or to ANY mailing lists to which I am subscribed, whether intentionally or accidentally, you are agreeing that I am "the intended recipient," and that I may do whatever I wish with the contents of any message received from you, unless a pre-existing agreement prohibits me from so doing. This overrides any disclaimer or statement of confidentiality that may be included on your message. _______________________________________________ Gtk-sharp-list maillist - Gtk-sharp-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/gtk-sharp-list