Re: Removing Widgets From Gtk::Table



Murray Cumming wrote:

I've had a similar problem.  IIRC, I fixed it by removing things from
the
Gtk::Table object directly, via Gtk::Table::remove, rather than from the
auxiliary Table_Helpers::TableList one.  Try it.
That did the trick, thanks!

Having said that though, does that mean that the
Table_Helpers::TableList interface just doesn't work?

All API is meant to work.

Or was it just
never intended to be used in the manner I was attempting (using the
Table_Helpers::TableList::iterator to remove specific widgets from a
table).


Probably, yes. A very simple compileable test case would be helpful.
I'm gonna disagree on this one. After doing a couple minutes of reading, I don't think that child modifications are meant to be done on the list returned by children. Very few api's that I know of present live lists like that.

Now, the only thing I'm not sure about is the m4 macro that looks like the implementation for Gtk::Table::children().

I'm guessing, that its wrapping gtk_container_get_children() in gtk.

The docs for this are at:
http://developer.gnome.org/doc/API/2.0/gtk/GtkContainer.html#gtk-container-get-children

Anyway, if you go and look at the implementation for this function, it uses gtk_container_foreach()
Docs at:
http://developer.gnome.org/doc/API/2.0/gtk/GtkContainer.html#gtk-container-foreach

Anyway, the call back for the call to foreach is:

static void
gtk_container_children_callback (GtkWidget *widget,
                gpointer   client_data)
{
 GList **children;

 children = (GList**) client_data;
 *children = g_list_prepend (*children, widget);
}

Notice its copying the list. Hence, no live back end, and therefore, no delete by removing and object from the list.

Granted, I haven't fully traced this out, but I'm fairly certain thats how things are working here. A quick check would be delete something from the list, get the list again and see if it shows up.

#m4 directives are crazy by the way. Granted they probably help quite a bit for wrappers like Gtkmm. But, really, thats pretty crazy.

Paul

Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list




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