1wxDialog(3) Erlang Module Definition wxDialog(3)
2
3
4
6 wxDialog - Functions for wxDialog class
7
9 A dialog box is a window with a title bar and sometimes a system menu,
10 which can be moved around the screen. It can contain controls and other
11 windows and is often used to allow the user to make some choice or to
12 answer a question.
13
14 Dialogs can be made scrollable, automatically, for computers with low
15 resolution screens: please see overview_dialog_autoscrolling for fur‐
16 ther details.
17
18 Dialogs usually contain either a single button allowing to close the
19 dialog or two buttons, one accepting the changes and the other one dis‐
20 carding them (such button, if present, is automatically activated if
21 the user presses the "Esc" key). By default, buttons with the standard
22 wxID_OK and wxID_CANCEL identifiers behave as expected. Starting with
23 wxWidgets 2.7 it is also possible to use a button with a different
24 identifier instead, see setAffirmativeId/2 and SetEscapeId() (not im‐
25 plemented in wx).
26
27 Also notice that the createButtonSizer/2 should be used to create the
28 buttons appropriate for the current platform and positioned correctly
29 (including their order which is platform-dependent).
30
31 Modal and Modeless
32
33 There are two kinds of dialog, modal and modeless. A modal dialog
34 blocks program flow and user input on other windows until it is dis‐
35 missed, whereas a modeless dialog behaves more like a frame in that
36 program flow continues, and input in other windows is still possible.
37 To show a modal dialog you should use the showModal/1 method while to
38 show a dialog modelessly you simply use show/2, just as with frames.
39
40 Note that the modal dialog is one of the very few examples of wxWindow-
41 derived objects which may be created on the stack and not on the heap.
42 In other words, while most windows would be created like this:
43
44 You can achieve the same result with dialogs by using simpler code:
45
46 An application can define a wxCloseEvent handler for the dialog to re‐
47 spond to system close events.
48
49 Styles
50
51 This class supports the following styles:
52
53 See: Overview dialog, wxFrame, Overview validator
54
55 This class is derived (and can use functions) from: wxTopLevelWindow
56 wxWindow wxEvtHandler
57
58 wxWidgets docs: wxDialog
59
61 Event types emitted from this class: close_window, init_dialog
62
64 wxDialog() = wx:wx_object()
65
67 new() -> wxDialog()
68
69 Default constructor.
70
71 new(Parent, Id, Title) -> wxDialog()
72
73 Types:
74
75 Parent = wxWindow:wxWindow()
76 Id = integer()
77 Title = unicode:chardata()
78
79 new(Parent, Id, Title, Options :: [Option]) -> wxDialog()
80
81 Types:
82
83 Parent = wxWindow:wxWindow()
84 Id = integer()
85 Title = unicode:chardata()
86 Option =
87 {pos, {X :: integer(), Y :: integer()}} |
88 {size, {W :: integer(), H :: integer()}} |
89 {style, integer()}
90
91 Constructor.
92
93 See: create/5
94
95 destroy(This :: wxDialog()) -> ok
96
97 Destructor.
98
99 Deletes any child windows before deleting the physical window.
100
101 See overview_windowdeletion for more info.
102
103 create(This, Parent, Id, Title) -> boolean()
104
105 Types:
106
107 This = wxDialog()
108 Parent = wxWindow:wxWindow()
109 Id = integer()
110 Title = unicode:chardata()
111
112 create(This, Parent, Id, Title, Options :: [Option]) -> boolean()
113
114 Types:
115
116 This = wxDialog()
117 Parent = wxWindow:wxWindow()
118 Id = integer()
119 Title = unicode:chardata()
120 Option =
121 {pos, {X :: integer(), Y :: integer()}} |
122 {size, {W :: integer(), H :: integer()}} |
123 {style, integer()}
124
125 Used for two-step dialog box construction.
126
127 See: new/4
128
129 createButtonSizer(This, Flags) -> wxSizer:wxSizer()
130
131 Types:
132
133 This = wxDialog()
134 Flags = integer()
135
136 Creates a sizer with standard buttons.
137
138 flags is a bit list of the following flags: wxOK, wxCANCEL,
139 wxYES, wxNO, wxAPPLY, wxCLOSE, wxHELP, wxNO_DEFAULT.
140
141 The sizer lays out the buttons in a manner appropriate to the
142 platform.
143
144 This function uses createStdDialogButtonSizer/2 internally for
145 most platforms but doesn't create the sizer at all for the plat‐
146 forms with hardware buttons (such as smartphones) for which it
147 sets up the hardware buttons appropriately and returns NULL, so
148 don't forget to test that the return value is valid before using
149 it.
150
151 createStdDialogButtonSizer(This, Flags) ->
152 wxStdDialogButtonSizer:wxStdDialogButtonSizer()
153
154 Types:
155
156 This = wxDialog()
157 Flags = integer()
158
159 Creates a wxStdDialogButtonSizer with standard buttons.
160
161 flags is a bit list of the following flags: wxOK, wxCANCEL,
162 wxYES, wxNO, wxAPPLY, wxCLOSE, wxHELP, wxNO_DEFAULT.
163
164 The sizer lays out the buttons in a manner appropriate to the
165 platform.
166
167 endModal(This, RetCode) -> ok
168
169 Types:
170
171 This = wxDialog()
172 RetCode = integer()
173
174 Ends a modal dialog, passing a value to be returned from the
175 showModal/1 invocation.
176
177 See: showModal/1, getReturnCode/1, setReturnCode/2
178
179 getAffirmativeId(This) -> integer()
180
181 Types:
182
183 This = wxDialog()
184
185 Gets the identifier of the button which works like standard OK
186 button in this dialog.
187
188 See: setAffirmativeId/2
189
190 getReturnCode(This) -> integer()
191
192 Types:
193
194 This = wxDialog()
195
196 Gets the return code for this window.
197
198 Remark: A return code is normally associated with a modal dia‐
199 log, where showModal/1 returns a code to the application.
200
201 See: setReturnCode/2, showModal/1, endModal/2
202
203 isModal(This) -> boolean()
204
205 Types:
206
207 This = wxDialog()
208
209 Returns true if the dialog box is modal, false otherwise.
210
211 setAffirmativeId(This, Id) -> ok
212
213 Types:
214
215 This = wxDialog()
216 Id = integer()
217
218 Sets the identifier to be used as OK button.
219
220 When the button with this identifier is pressed, the dialog
221 calls wxWindow:validate/1 and wxWindow:transferDataFromWindow/1
222 and, if they both return true, closes the dialog with the affir‐
223 mative id return code.
224
225 Also, when the user presses a hardware OK button on the devices
226 having one or the special OK button in the PocketPC title bar,
227 an event with this id is generated.
228
229 By default, the affirmative id is wxID_OK.
230
231 See: getAffirmativeId/1, SetEscapeId() (not implemented in wx)
232
233 setReturnCode(This, RetCode) -> ok
234
235 Types:
236
237 This = wxDialog()
238 RetCode = integer()
239
240 Sets the return code for this window.
241
242 A return code is normally associated with a modal dialog, where
243 showModal/1 returns a code to the application. The function end‐
244 Modal/2 calls setReturnCode/2.
245
246 See: getReturnCode/1, showModal/1, endModal/2
247
248 show(This) -> boolean()
249
250 Types:
251
252 This = wxDialog()
253
254 show(This, Options :: [Option]) -> boolean()
255
256 Types:
257
258 This = wxDialog()
259 Option = {show, boolean()}
260
261 Hides or shows the dialog.
262
263 The preferred way of dismissing a modal dialog is to use end‐
264 Modal/2.
265
266 showModal(This) -> integer()
267
268 Types:
269
270 This = wxDialog()
271
272 Shows an application-modal dialog.
273
274 Program flow does not return until the dialog has been dismissed
275 with endModal/2.
276
277 Notice that it is possible to call showModal/1 for a dialog
278 which had been previously shown with show/2, this allows making
279 an existing modeless dialog modal. However showModal/1 can't be
280 called twice without intervening endModal/2 calls.
281
282 Note that this function creates a temporary event loop which
283 takes precedence over the application's main event loop (see wx‐
284 EventLoopBase (not implemented in wx)) and which is destroyed
285 when the dialog is dismissed. This also results in a call to
286 wxApp::ProcessPendingEvents() (not implemented in wx).
287
288 Return: The value set with setReturnCode/2.
289
290 See: ShowWindowModal() (not implemented in wx), ShowWindow‐
291 ModalThenDo() (not implemented in wx), endModal/2, getReturn‐
292 Code/1, setReturnCode/2
293
294
295
296wxWidgets team. wx 2.2.2 wxDialog(3)