Re: Help me kill the second top leve widget without killing the first one

Subhrangshu Supakar wrote:
   In my code for a software the main window that appears at first, contains
   tool XXXXXXXX.
   On clicking this tool it generates a graph (using GD::Graph) and displays
   on a second window ( toplevel widget , $Window =
   Gtk2::Window->new('toplevel')) , which provides some more tools for
   maipulating the generated graph. This window also contains an 'Quit' menu
   linked as: $HdrMenuItmQuit->signal _connect('activate' => sub
   The problem is on the first click on 'Quit' button nothing happens but on
   the second click the second window as well as the first window, both
   disappears and I don't get error messege. At the same time the X button
   the window works absolutely fine.

The window X button sends the "delete-event" to the window.  The default
handler for a delete event is simply to destroy the window.

What you are doing is killing the main loop in your quit handler.  This lets
the program run to completion, at which point both windows are destroyed and
cleaned up.  This isn't what you want it to do, obviously.  The second
window's "quit" should be a "close", and its handler should destroy the
window, not kill the main loop.

muppet <scott at asofyet dot org>

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