Re: [gtk-list] Destroying windows & widgets -- anybody?




On Wed, 26 Aug 1998, Robert Knop wrote:
> 
> How to do this with just Gtk+ would be useful.  In actuality, I'm trying
> to do this with Gtk--.  I'd like to know what calls are necessary to get
> the thing to be pulled out of what Gtk_Main is watching for events, and
> have all of the destructors called.
> 

It is different in Gtk+ and Gtk--. In Gtk+, calling gtk_widget_destroy on
a parent widget will destroy that widget and all its children (well,
usually - underneath it actually does refcounting and occasionally this
will matter). 

In Gtk-- destroying a parent does *not* destroy the children. To destroy a
widget you use delete, and you have to do it for all children of a widget.
(Note that this means all C++ children you've added yourself - widgets
that come with their own children like GtkFileSelection will destroy those
children.) 

If a widget isn't dynamically allocated, you don't have to call delete
obviously; it will be destroyed when it goes out of scope or the object
it's a member of is destroyed. (This is why Gtk-- doesn't destroy
children, so that widgets can be member variables.)

Havoc




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