Gtk::Window should not auto-destruct



In gtkmm-1.2, Gtk::Window self-destructs when the window manager's close
button is clicked, unless you return TRUE from a delete_event signal
handler. This is described here:
http://developer.gnome.org/doc/GGAD/z207.html

This is silly. Unusual memory management should not be the default. I
plan to change this in gtkmm-1.3, as I did for Gnome::Dialog in gnomemm.
I will add a Gtk::Window::set_destroy_on_delete_event_() method for
temporary compatibility.

Instead, you should just connect to the Gtk::Wdget::hide signal,
inherited by Gtk::Window, and do whatever you want then. This allows you
to reshow a window later, or destroy it, or quit the whole program.

Wonder why you never knew this before? Because on_delete_event() was
called delete_event_impl(). And because we mistakenly used the useless
"destroy_event" signal in some of our examples instead. We don't wrap
"destroy_event" anymore.


-- 
Murray Cumming
murrayc usa net
www.murrayc.com




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