Window.onclose¶
An event being sent 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 Window:close function.
You should check whether the application is forcing the deletion of the window usingCloseEvent:canVeto. If this isfalse, you must destroy the window usingWindow:destroy. If the return value istrue, it is up to you whether you respond by destroying the window. If you don’t destroy the window, you should callCloseEvent:vetoto let the calling code know that you did not destroy the window. This allows theWindow:closefunction to returntrueorfalsedepending on whether the close instruction was honoured or not.
Example¶
This example prints the name of the Window when it’s shown.
1 2 3 4 5 | local function onShowHandler ( CloseEvent )
print ( 'the Window is "'.. CloseEvent:getSender():getName() ..'"' )
end
myWindow.onEnter : setHandler(onEnterHandler)
|