Re: Closing a window to trigger the 'delete_event' signal



On Thu, Jul 29, 2004 at 02:39:47AM +0200, Torsten Schoenfeld wrote:
Oh, looks like something changed in some wrapper code then.  If you use

  Gtk2::Gdk::Event -> new("nothing")

instead of undef, it should work with Gtk2 >= 1.031, though.

Thanks, it works now!

So is this the idiomatic way to do close a Window in GTK2 ?

  sub {
    unless ($window->signal_emit('delete_event',
            Gtk2::Gdk::Event->new("nothing")))
    {
      $window->destroy();
    }
  }

I was somehow expecting to be able to do something like
$window->close() and have it check the signal and do the right thing.
All the tutorials I've seen either call $window->destroy() or
Gtk2->main_quit directly, bypassing the delete_event completely.

Francois



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