File: wx71.htm

package info (click to toggle)
wxwin2-doc 2.01-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 6,540 kB
  • ctags: 5,968
  • sloc: cpp: 15,157; makefile: 434; sh: 6
file content (379 lines) | stat: -rw-r--r-- 14,014 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
<HTML>
<head><title>wxDialog</title></head>

<BODY BGCOLOR=#FFFFFF>
<A NAME="wxdialog"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx22.htm#classref"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx70.htm#wxdebugstreambuf"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx72.htm#wxdirdialog"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>

<H2>wxDialog</H2>
<P>
A dialog box is a window with a title bar and sometimes a system menu, which can be moved around
the screen. It can contain controls and other windows.<P>
<B><FONT COLOR="#FF0000">Derived from</FONT></B><P>
<A HREF="wx166.htm#wxpanel">wxPanel</A><BR>

<A HREF="wx260.htm#wxwindow">wxWindow</A><BR>

<A HREF="wx85.htm#wxevthandler">wxEvtHandler</A><BR>

<A HREF="wx158.htm#wxobject">wxObject</A><P>
<B><FONT COLOR="#FF0000">Include files</FONT></B><P>
&lt;wx/dialog.h&gt;<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
There are two kinds of dialog - <I>modal</I> and <I>modeless</I>. A modal dialog
blocks program flow and user input on other windows until it is dismissed, whereas a modeless dialog behaves more
like a frame in that program flow continues, and input on other windows is still possible.
You specify the type of dialog with the <B>wxDIALOG_MODAL</B> and <B>wxDIALOG_MODELESS</B> window
styles.<P>
A dialog may be loaded from a wxWindows resource file (extension <TT>wxr</TT>).<P>
An application can define an <A HREF="wx260.htm#wxwindowonclosewindow">OnCloseWindow</A> handler for the
dialog to respond to system close events.<P>
<B><FONT COLOR="#FF0000">Window styles</FONT></B><P>


<TABLE>


<TR><TD VALIGN=TOP>
<B>wxCAPTION</B>
</TD>

<TD VALIGN=TOP>
Puts a caption on the dialog box (Motif only).
</TD></TR>


<TR><TD VALIGN=TOP>
<B>wxDEFAULT_DIALOG_STYLE</B>
</TD>

<TD VALIGN=TOP>
Equivalent to a combination of wxCAPTION, wxSYSTEM_MENU and wxTHICK_FRAME
</TD></TR>


<TR><TD VALIGN=TOP>
<B>wxRESIZE_BORDER</B>
</TD>

<TD VALIGN=TOP>
Display a resizeable frame around the window (Motif only).
</TD></TR>


<TR><TD VALIGN=TOP>
<B>wxSYSTEM_MENU</B>
</TD>

<TD VALIGN=TOP>
Display a system menu.
</TD></TR>


<TR><TD VALIGN=TOP>
<B>wxTHICK_FRAME</B>
</TD>

<TD VALIGN=TOP>
Display a thick frame around the window.
</TD></TR>


<TR><TD VALIGN=TOP>
<B>wxSTAY_ON_TOP</B>
</TD>

<TD VALIGN=TOP>
The dialog stays on top of all other windows (Windows only).
</TD></TR>


<TR><TD VALIGN=TOP>
<B>wxNO_3D</B>
</TD>

<TD VALIGN=TOP>
Under Windows, specifies that the child controls
should not have 3D borders unless specified in the control.
</TD></TR>


</TABLE>
<P>
Under Motif, MWM (the Motif Window Manager) should be running for any of these styles to have an effect.<P>
See also <A HREF="wx305.htm#windowstyles">Generic window styles</A>.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx285.htm#wxdialogoverview">wxDialog overview</A>, <A HREF="wx104.htm#wxframe">wxFrame</A>, <A HREF="wx14.htm#resources">Resources</A>,
<A HREF="wx309.htm#validatoroverview">Validator overview</A><P>
<B><FONT COLOR="#FF0000">Members</FONT></B><P>
<A HREF="#wxdialogconstr">wxDialog::wxDialog</A><BR>
<A HREF="#topic201">wxDialog::~wxDialog</A><BR>
<A HREF="#wxdialogcentre">wxDialog::Centre</A><BR>
<A HREF="#wxdialogcreate">wxDialog::Create</A><BR>
<A HREF="#wxdialogendmodal">wxDialog::EndModal</A><BR>
<A HREF="#wxdialoggettitle">wxDialog::GetTitle</A><BR>
<A HREF="#wxdialogiconized">wxDialog::Iconize</A><BR>
<A HREF="#wxdialogisiconized">wxDialog::IsIconized</A><BR>
<A HREF="#wxdialogismodal">wxDialog::IsModal</A><BR>
<A HREF="#wxdialogoncharhook">wxDialog::OnCharHook</A><BR>
<A HREF="#wxdialogonapply">wxDialog::OnApply</A><BR>
<A HREF="#wxdialogoncancel">wxDialog::OnCancel</A><BR>
<A HREF="#wxdialogonok">wxDialog::OnOK</A><BR>
<A HREF="#wxdialogonsyscolourchanged">wxDialog::OnSysColourChanged</A><BR>
<A HREF="#wxdialogsetmodal">wxDialog::SetModal</A><BR>
<A HREF="#wxdialogsettitle">wxDialog::SetTitle</A><BR>
<A HREF="#wxdialogshow">wxDialog::Show</A><BR>
<A HREF="#wxdialogshowmodal">wxDialog::ShowModal</A><BR>
<P>

<HR>
<A NAME="wxdialogconstr"></A>
<H3>wxDialog::wxDialog</H3>
<P>
<B></B> <B>wxDialog</B>()<P>
Default constructor.<P>
<B></B> <B>wxDialog</B>(<B>wxWindow* </B><I>parent</I>, <B>wxWindowID </B><I>id</I>,
<B>const wxString&amp; </B><I>title</I>,
<B>const wxPoint&amp; </B><I>pos = wxDefaultPosition</I>,
<B>const wxSize&amp; </B><I>size = wxDefaultSize</I>,
<B>long</B><I> style = wxDEFAULT_DIALOG_STYLE</I>,
<B>const wxString&amp; </B><I>name = "dialogBox"</I>)<P>
Constructor.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>parent</I><UL><UL>
Can be NULL, a frame or another dialog box.</UL></UL>
<P>
<I>id</I><UL><UL>
An identifier for the dialog. A value of -1 is taken to mean a default.</UL></UL>
<P>
<I>title</I><UL><UL>
The title of the dialog.</UL></UL>
<P>
<I>pos</I><UL><UL>
The dialog position. A value of (-1, -1) indicates a default position, chosen by
either the windowing system or wxWindows, depending on platform.</UL></UL>
<P>
<I>size</I><UL><UL>
The dialog size. A value of (-1, -1) indicates a default size, chosen by
either the windowing system or wxWindows, depending on platform.</UL></UL>
<P>
<I>style</I><UL><UL>
The window style. See <A HREF="wx71.htm#wxdialog">wxDialog</A>.</UL></UL>
<P>
<I>name</I><UL><UL>
Used to associate a name with the window,
allowing the application user to set Motif resource values for
individual dialog boxes.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx71.htm#wxdialogcreate">wxDialog::Create</A><P>

<HR>
<A NAME="topic201"></A>
<H3>wxDialog::~wxDialog</H3>
<P>
<B></B> <B>~wxDialog</B>()<P>
Destructor. Deletes any child windows before deleting the physical window.<P>

<HR>
<A NAME="wxdialogcentre"></A>
<H3>wxDialog::Centre</H3>
<P>
<B>void</B> <B>Centre</B>(<B>int</B><I> direction = wxBOTH</I>)<P>
Centres the dialog box on the display.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>direction</I><UL><UL>
May be <TT>wxHORIZONTAL</TT>, <TT>wxVERTICAL</TT> or <TT>wxBOTH</TT>.</UL></UL>
<P>

<HR>
<A NAME="wxdialogcreate"></A>
<H3>wxDialog::Create</H3>
<P>
<B>bool</B> <B>Create</B>(<B>wxWindow* </B><I>parent</I>, <B>wxWindowID </B><I>id</I>,
<B>const wxString&amp; </B><I>title</I>,
<B>const wxPoint&amp; </B><I>pos = wxDefaultPosition</I>,
<B>const wxSize&amp; </B><I>size = wxDefaultSize</I>,
<B>long</B><I> style = wxDEFAULT_DIALOG_STYLE</I>,
<B>const wxString&amp; </B><I>name = "dialogBox"</I>)<P>
Used for two-step dialog box construction. See <A HREF="wx71.htm#wxdialogconstr">wxDialog::wxDialog</A>
for details.<P>

<HR>
<A NAME="wxdialogendmodal"></A>
<H3>wxDialog::EndModal</H3>
<P>
<B>void</B> <B>EndModal</B>(<B>int </B><I>retCode</I>)<P>
Ends a modal dialog, passing a value to be returned from the <A HREF="wx71.htm#wxdialogshowmodal">wxDialog::ShowModal</A>
invocation.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>retCode</I><UL><UL>
The value that should be returned by <B>ShowModal</B>.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx71.htm#wxdialogshowmodal">wxDialog::ShowModal</A>,
<A HREF="wx260.htm#wxwindowgetreturncode">wxWindow::GetReturnCode</A>,
<A HREF="wx260.htm#wxwindowsetreturncode">wxWindow::SetReturnCode</A><P>

<HR>
<A NAME="wxdialoggettitle"></A>
<H3>wxDialog::GetTitle</H3>
<P>
<B>wxString</B> <B>GetTitle</B>() <B>const</B><P>
Returns the title of the dialog box.<P>

<HR>
<A NAME="wxdialogiconized"></A>
<H3>wxDialog::Iconize</H3>
<P>
<B>void</B> <B>Iconize</B>(<B>const bool</B><I> iconize</I>)<P>
Iconizes or restores the dialog.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>iconize</I><UL><UL>
If TRUE, iconizes the dialog box; if FALSE, shows and restores it.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
Note that in Windows, iconization has no effect since dialog boxes cannot be
iconized. However, applications may need to explicitly restore dialog
boxes under Motif which have user-iconizable frames, and under Windows
calling <TT>Iconize(FALSE)</TT> will bring the window to the front, as does
<TT>Show(TRUE)</TT>.<P>

<HR>
<A NAME="wxdialogisiconized"></A>
<H3>wxDialog::IsIconized</H3>
<P>
<B>bool</B> <B>IsIconized</B>() <B>const</B><P>
Returns TRUE if the dialog box is iconized.<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
Always returns FALSE under Windows since dialogs cannot be iconized.<P>

<HR>
<A NAME="wxdialogismodal"></A>
<H3>wxDialog::IsModal</H3>
<P>
<B>bool</B> <B>IsModal</B>() <B>const</B><P>
Returns TRUE if the dialog box is modal, FALSE otherwise.<P>

<HR>
<A NAME="wxdialogoncharhook"></A>
<H3>wxDialog::OnCharHook</H3>
<P>
<B>void</B> <B>OnCharHook</B>(<B>wxKeyEvent&amp;</B><I> event</I>)<P>
This member is called to allow the window to intercept keyboard events
before they are processed by child windows.<P>
For more information, see <A HREF="wx260.htm#wxwindowoncharhook">wxWindow::OnCharHook</A><P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
wxDialog implements this handler to fake a cancel command if the escape key has been
pressed. This will dismiss the dialog.<P>

<HR>
<A NAME="wxdialogonapply"></A>
<H3>wxDialog::OnApply</H3>
<P>
<B>void</B> <B>OnApply</B>(<B>wxCommandEvent&amp; </B><I>event</I>)<P>
The default handler for the wxID_APPLY identifier.<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
This function calls <A HREF="wx260.htm#wxwindowvalidate">wxWindow::Validate</A> and <A HREF="wx260.htm#wxwindowtransferdatatowindow">wxWindow::TransferDataToWindow</A>.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx71.htm#wxdialogonok">wxDialog::OnOK</A>, <A HREF="wx71.htm#wxdialogoncancel">wxDialog::OnCancel</A><P>

<HR>
<A NAME="wxdialogoncancel"></A>
<H3>wxDialog::OnCancel</H3>
<P>
<B>void</B> <B>OnCancel</B>(<B>wxCommandEvent&amp; </B><I>event</I>)<P>
The default handler for the wxID_CANCEL identifier.<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
The function either calls <B>EndModal(wxID_CANCEL)</B> if the dialog is modal, or
sets the return value to wxID_CANCEL and calls <B>Show(FALSE)</B> if the dialog is modeless.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx71.htm#wxdialogonok">wxDialog::OnOK</A>, <A HREF="wx71.htm#wxdialogonapply">wxDialog::OnApply</A><P>

<HR>
<A NAME="wxdialogonok"></A>
<H3>wxDialog::OnOK</H3>
<P>
<B>void</B> <B>OnOK</B>(<B>wxCommandEvent&amp; </B><I>event</I>)<P>
The default handler for the wxID_OK identifier.<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
The function calls
<A HREF="wx260.htm#wxwindowvalidate">wxWindow::Validate</A>, then <A HREF="wx260.htm#wxwindowtransferdatafromwindow">wxWindow::TransferDataFromWindow</A>.
If this returns TRUE, the function either calls <B>EndModal(wxID_OK)</B> if the dialog is modal, or
sets the return value to wxID_OK and calls <B>Show(FALSE)</B> if the dialog is modeless.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx71.htm#wxdialogoncancel">wxDialog::OnCancel</A>, <A HREF="wx71.htm#wxdialogonapply">wxDialog::OnApply</A><P>

<HR>
<A NAME="wxdialogonsyscolourchanged"></A>
<H3>wxDialog::OnSysColourChanged</H3>
<P>
<B>void</B> <B>OnSysColourChanged</B>(<B>wxSysColourChangedEvent&amp; </B><I>event</I>)<P>
The default handler for wxEVT_SYS_COLOUR_CHANGED.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>event</I><UL><UL>
The colour change event.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
Changes the dialog's colour to conform to the current settings (Windows only).
Add an event table entry for your dialog class if you wish the behaviour
to be different (such as keeping a user-defined
background colour). If you do override this function, call <A HREF="wx260.htm#wxwindowonsyscolourchanged">wxWindow::OnSysColourChanged</A> to
propagate the notification to child windows and controls.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx227.htm#wxsyscolourchangedevent">wxSysColourChangedEvent</A><P>

<HR>
<A NAME="wxdialogsetmodal"></A>
<H3>wxDialog::SetModal</H3>
<P>
<B>void</B> <B>SetModal</B>(<B>const bool</B><I> flag</I>)<P>
Allows the programmer to specify whether the dialog box is modal (wxDialog::Show blocks control
until the dialog is hidden) or modeless (control returns immediately).<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>flag</I><UL><UL>
If TRUE, the dialog will be modal, otherwise it will be modeless.</UL></UL>
<P>

<HR>
<A NAME="wxdialogsettitle"></A>
<H3>wxDialog::SetTitle</H3>
<P>
<B>void</B> <B>SetTitle</B>(<B>const wxString&amp; </B><I> title</I>)<P>
Sets the title of the dialog box.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>title</I><UL><UL>
The dialog box title.</UL></UL>
<P>

<HR>
<A NAME="wxdialogshow"></A>
<H3>wxDialog::Show</H3>
<P>
<B>bool</B> <B>Show</B>(<B>const bool</B><I> show</I>)<P>
Hides or shows the dialog.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>show</I><UL><UL>
If TRUE, the dialog box is shown and brought to the front;
otherwise the box is hidden. If FALSE and the dialog is
modal, control is returned to the calling program.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
The preferred way of dismissing a modal dialog is to use <A HREF="wx71.htm#wxdialogendmodal">wxDialog::EndModal</A>.<P>

<HR>
<A NAME="wxdialogshowmodal"></A>
<H3>wxDialog::ShowModal</H3>
<P>
<B>int</B> <B>ShowModal</B>()<P>
Shows a modal dialog. Program flow does not return until the dialog has been dismissed with
<A HREF="wx71.htm#wxdialogendmodal">wxDialog::EndModal</A>.<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
The return value is the value set with <A HREF="wx260.htm#wxwindowsetreturncode">wxWindow::SetReturnCode</A>.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx71.htm#wxdialogendmodal">wxDialog::EndModal</A>,
<A HREF="wx260.htm#wxwindowgetreturncode">wxWindow::GetReturnCode</A>,
<A HREF="wx260.htm#wxwindowsetreturncode">wxWindow::SetReturnCode</A><P>


</BODY></HTML>