Package wx :: Class CloseEvent
[frames | no frames]

Type CloseEvent

object --+        
         |        
    Object --+    
             |    
         Event --+
                 |
                CloseEvent


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 controls or the system menu. It can also be invoked by the application itself programmatically, for example by calling the wx.Window.Close function.

You should check whether the application is forcing the deletion of the window using CanVeto. If it returns False, you must destroy the window using wx.Window.Destroy. If the return value is True, it is up to you whether you respond by destroying the window or not. For example you may wish to display a message dialog prompting to save files or to cancel the close.

If you don't destroy the window, you should call Veto to let the calling code know that you did not destroy the window. This allows the wx.Window.Close function to return True or False depending on whether the close instruction was honored or not.

Events

wx.EVT_CLOSE This event is sent to a top-level window when it has been requested to close either from the user or programatically.
wx.EVT_QUERY_END_SESSION This event is sent to the wx.App when the system is about to be logged off, giving the app a chance to veto the shutdown.
wx.EVT_END_SESSION This event is sent to the wx.App when the system is being logged off.

Method Summary
CloseEvent __init__(self, type, winid)
Constructor.
bool CanVeto(self)
Returns true if you can veto a system shutdown or a window close event.
bool GetLoggingOff(self)
Returns True if the user is logging off or False if the system is shutting down.
bool GetVeto(self)
  SetCanVeto(self, canVeto)
Sets the 'can veto' flag.
  SetLoggingOff(self, logOff)
Sets the 'logging off' flag.
  Veto(self, veto)
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.

Property Summary
  LoggingOff: See GetLoggingOff and SetLoggingOff
  thisown: The membership flag

Method Details

__init__(self, type=wxEVT_NULL, winid=0)
(Constructor)

Constructor.

Parameters:
type
           (type=EventType)

winid
           (type=int)

Returns:
CloseEvent
Overrides:
wx.Event.__init__

CanVeto(self)

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:
bool

GetLoggingOff(self)

Returns True if the user is 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.

Returns:
bool

SetCanVeto(self, canVeto)

Sets the 'can veto' flag.

Parameters:
canVeto
           (type=bool)

SetLoggingOff(self, logOff)

Sets the 'logging off' flag.

Parameters:
logOff
           (type=bool)

Veto(self, veto=True)

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 or close if CanVeto returns true.

Parameters:
veto
           (type=bool)


Property Details

LoggingOff

See GetLoggingOff and SetLoggingOff

Get Method:
GetLoggingOff(self)
Set Method:
SetLoggingOff(self, logOff)

thisown

The membership flag


Generated by Epydoc 2.1.20050511.rpd on Thu Mar 22 12:07:01 2007 http://epydoc.sf.net