Re: Errors removing rows from treestore
- From: Bob Caryl <bob fis-cal com>
- To: Matt Bragano <maestro485 comcast net>
- Cc: gtkmm-list gnome org
- Subject: Re: Errors removing rows from treestore
- Date: Mon, 12 Jun 2006 08:07:34 -0500
The following are guesses made after reading the docs on TreeModelFilter:
First off, you probably will want to convert the iterator passed to your
callback slot to an iterator in the child TreeModel you used to create
your TreeModelFilter using:
Gtk::TreeModelFilter::convert_iter_to_child_iter()
since, most probably, the iter being passed to your callback is from the
TreeModelFilter instead of the actual TreeModel you originally populated.
Next, you make the assumption that the iterator "child" is valid.
Instead of the while loop you are employing, try this instead:
for(child = nodeChildren.begin(); child ; child =
refTreeModel->erase(*child));
At least this way, you won't get any invalid child object errors.
Bob
Matt Bragano wrote:
After much help, I've successfully implemented a TreeModel with a
TreeModelFilter. However, I've noticed that if I expand a node,
collapse it and expand it again, the contents are "doubled". That is,
if the expanded row contained items A and B, on the second expansion
the items in the row are now A B A B.
I tried using a model column flag to determine if the tree had been
expanded once prior, but with no luck. Now I'm trying to simply
remove the child rows in the on_row_collapsed() method like this:
void on_row_collapsed(const Gtk::TreeModel::iterator& iter,
const Gtk::TreeModel::Path &path) {
Gtk::TreeModel::Row row = *iter;
const Gtk::TreeNodeChildren &nodeChildren = row.children();
Gtk::TreeModel::Children::iterator child = nodeChildren.begin();
while(child != nodeChildren.end()) {
child = refTreeModel->erase(*child); // this causes errors
}
}
The problem is that every time the while loop is executed I recieve
this error:
Gtk-CRITICAL **: gtk_tree_store_remove: assertion `VALID_ITER (iter,
tree_store)' failed
Any ideas as to what is the problem here? Or is there a better way to
work around the doubled-up rows I'm running into?
Thanks,
Matt Bragano
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
begin:vcard
fn:Robert Caryl
n:Caryl;Robert
org:Fiscal Systems, Inc.
adr:;;102 Commerce Circle;Madison;AL;35758;USA
email;internet:bob fis-cal com
title:Senior Software Design Engineer
tel;work:356-772-8920 X108
x-mozilla-html:TRUE
url:http://www.fis-cal.com
version:2.1
end:vcard
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]