[gtkmm] Deleting child widgets in a Gtk::Table
- From: Roger Leigh <roger whinlatter uklinux net>
- To: gtkmm-list <gtkmm-list gnome org>
- Subject: [gtkmm] Deleting child widgets in a Gtk::Table
- Date: Wed, 28 Apr 2004 17:47:12 +0100
I have a widget derived from Gtk::Table containing child widgets. One
of the functions of my widget is to add and remove columns. When the
remove_column() method is called, I want to:
* Remove all widgets which are in the column, or overlapping on to it.
* Resize the table to remove the column (the table is homogeneous).
The method looks like this:
TableList& tl = children();
for (TableList::iterator cur = tl.begin();
cur != tl.end();
++cur)
{
[check the widget overlaps -- this part works]
cur = tl.erase(cur);
}
resize(property_n_rows(), property_n_columns() - 1);
With a 3×3 table, this is printed (I added some logging to show the
checking as the attach coordinates):
Check overlap: 2,3,0,3
2,3,2,3 = overlap
Deleting widget at 2,2
(epicpos:10851): Gtk-CRITICAL **: file gtkcontainer.c: line 983
(gtk_container_remove): assertion `GTK_IS_WIDGET (widget)' failed
2,3,0,1 = overlap
Deleting widget at 2,0
(epicpos:10851): Gtk-CRITICAL **: file gtkcontainer.c: line 983
(gtk_container_remove): assertion `GTK_IS_WIDGET (widget)' failed
The widget with top-left corner (2,1) was skipped. Am I using the
TableList::erase method incorrectly? Are the iterators invalidated by
an erase()?
Thanks,
Roger
--
Roger Leigh
Printing on GNU/Linux? http://gimp-print.sourceforge.net/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]