This event class contains information about window and session close events.
The handler function for EVT_CLOSE is called when the user has tried to close a a frame or dialog box using the window manager (X) or system menu (Windows). It can also be invoked by the application itself programmatically, for example by calling the
You should check whether the application is forcing the deletion of the window using
If the return value is true, it is up to you whether you respond by destroying the window.
If you don't destroy the window, you should call
Example of a
The EVT_END_SESSION event is slightly different as it is sent by the system when the user session is ending (e.g. because of log out or shutdown) and so all windows are being forcefully closed. At least under MSW, after the handler for this event is executed the program is simply killed by the system. Because of this, the default handler for this event provided by wxWidgets calls all the usual cleanup code (including
See:
This class is derived (and can use functions) from:
wxWidgets docs:
Use
Returns true if you can veto a system shutdown or a window close event.
Vetoing a window close event is not possible if the calling code wishes to force the application to exit, and so this function must be called to check this.
Returns true if the user is just logging off or false if the system is shutting down.
This method can only be called for end session and query end session events, it doesn't make sense for close window event.
Sets the 'can veto' flag.
Sets the 'logging off' flag.
Call this from your event handler to veto a system shutdown or to signal to the calling application that a window close did not happen.
You can only veto a shutdown if