Hi
My app has a main window and has the usual file->exit menu option.
But the user can also close the main window by using the close button (the cross in top right hand corner) - how can I catch this event?
TIA
Graham
Hi
My app has a main window and has the usual file->exit menu option.
But the user can also close the main window by using the close button (the cross in top right hand corner) - how can I catch this event?
TIA
Graham
GrahamLabdon (17th December 2010)
what a noob i am!
Note: this may not be a good idea. You're subverting the window manager's normal way of doing things, and users may be puzzled by this. Unless there's a good reason for doing things this way, I'd advise against it.
Also, if you decide to proceed, poke around in the window flags and see if the "X" close widget can be removed from the window. Again, this is just to avoid possible confusion; it would also eliminate the need to examine events, since there would never be one in such a case.
Nothing, in and of itself. I was raising concerns over the subversion of the window's close mechanism in the first place. If the "X" button is left on the window and simply stops working, users are easily confused by this change in standard behavior. To avoid such confusion, I'd favor removing the button altogether. It still "breaks" the traditional user interface design, but at least it's clear that the option isn't even available.
I think it's a good idea to catch the event to popup a "Do you wish to lose your unsaved work?" dialog. If they answer yes, you can always programmatically close the application.
Bookmarks