Advanced Search
Mail us
Home    Manuel    Links    Faq    Submit a tcl/tk Reference    Contact Us

    Some examples tcl/tk codes     Man of Bwidget     Man of blt     mkwidget screenshots     TkOgl     Video Demo real.


  How can I prevent my toplevel from being destroyed? How do I make my toplevel ignore the window manager delete button?
 
 You can capture the window manager delete window action with the
following:

wm protocol .toplevel WM_DELETE_WINDOW { puts "Don`t delete me" }

This overrides the window manager`s default action, so if you wanted to
have a clean up procedure execute before closing the window, you have to
make sure to close the window yourself.

The wm protocol will catch window manager generated close requests, not
internally generated `destroy .toplevel` calls resulting from user
commands.  Presumably, you have control over all user command
processing, and can call private close functions for explicit
confimation before removing the window.