1wxCloseEvent(3) Erlang Module Definition wxCloseEvent(3)
2
3
4
6 wxCloseEvent - Functions for wxCloseEvent class
7
9 This event class contains information about window and session close
10 events.
11
12 The handler function for EVT_CLOSE is called when the user has tried to
13 close a a frame or dialog box using the window manager (X) or system
14 menu (Windows). It can also be invoked by the application itself pro‐
15 grammatically, for example by calling the wxWindow:close/2 function.
16
17 You should check whether the application is forcing the deletion of the
18 window using canVeto/1. If this is false, you must destroy the window
19 using wxWindow:'Destroy'/1.
20
21 If the return value is true, it is up to you whether you respond by de‐
22 stroying the window.
23
24 If you don't destroy the window, you should call veto/2 to let the
25 calling code know that you did not destroy the window. This allows the
26 wxWindow:close/2 function to return true or false depending on whether
27 the close instruction was honoured or not.
28
29 Example of a wxCloseEvent handler:
30
31 The EVT_END_SESSION event is slightly different as it is sent by the
32 system when the user session is ending (e.g. because of log out or
33 shutdown) and so all windows are being forcefully closed. At least un‐
34 der MSW, after the handler for this event is executed the program is
35 simply killed by the system. Because of this, the default handler for
36 this event provided by wxWidgets calls all the usual cleanup code (in‐
37 cluding wxApp::OnExit() (not implemented in wx)) so that it could still
38 be executed and exit()s the process itself, without waiting for being
39 killed. If this behaviour is for some reason undesirable, make sure
40 that you define a handler for this event in your wxApp-derived class
41 and do not call event.Skip() in it (but be aware that the system will
42 still kill your application).
43
44 See: wxWindow:close/2, Overview windowdeletion
45
46 This class is derived (and can use functions) from: wxEvent
47
48 wxWidgets docs: wxCloseEvent
49
51 Use wxEvtHandler:connect/3 with wxCloseEventType to subscribe to events
52 of this type.
53
55 wxCloseEvent() = wx:wx_object()
56
57 wxClose() = #wxClose{type = wxCloseEvent:wxCloseEventType()}
58
59 wxCloseEventType() =
60 close_window | end_session | query_end_session
61
63 canVeto(This) -> boolean()
64
65 Types:
66
67 This = wxCloseEvent()
68
69 Returns true if you can veto a system shutdown or a window close
70 event.
71
72 Vetoing a window close event is not possible if the calling code
73 wishes to force the application to exit, and so this function
74 must be called to check this.
75
76 getLoggingOff(This) -> boolean()
77
78 Types:
79
80 This = wxCloseEvent()
81
82 Returns true if the user is just logging off or false if the
83 system is shutting down.
84
85 This method can only be called for end session and query end
86 session events, it doesn't make sense for close window event.
87
88 setCanVeto(This, CanVeto) -> ok
89
90 Types:
91
92 This = wxCloseEvent()
93 CanVeto = boolean()
94
95 Sets the 'can veto' flag.
96
97 setLoggingOff(This, LoggingOff) -> ok
98
99 Types:
100
101 This = wxCloseEvent()
102 LoggingOff = boolean()
103
104 Sets the 'logging off' flag.
105
106 veto(This) -> ok
107
108 Types:
109
110 This = wxCloseEvent()
111
112 veto(This, Options :: [Option]) -> ok
113
114 Types:
115
116 This = wxCloseEvent()
117 Option = {veto, boolean()}
118
119 Call this from your event handler to veto a system shutdown or
120 to signal to the calling application that a window close did not
121 happen.
122
123 You can only veto a shutdown if canVeto/1 returns true.
124
125
126
127wxWidgets team. wx 2.1 wxCloseEvent(3)