]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/dialog.tex
Added wxRect::Intersect() documentation (patch 1868322 from Laurent Humbertclaude).
[wxWidgets.git] / docs / latex / wx / dialog.tex
CommitLineData
60fef964
WS
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: dialog.tex
3%% Purpose: wxDialog documentation
4%% Author: wxWidgets Team
5%% Modified by:
6%% Created:
7%% RCS-ID: $Id$
8%% Copyright: (c) wxWidgets Team
9%% License: wxWindows license
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
a660d684
KB
12\section{\class{wxDialog}}\label{wxdialog}
13
1e4709b3
VZ
14A dialog box is a window with a title bar and sometimes a system menu, which
15can be moved around the screen. It can contain controls and other windows and
f9db2cda
VZ
16is often used to allow the user to make some choice or to answer a question.
17
3aa8e4ea 18Dialogs can be made scrollable, automatically: please see \helpref{Automatic scrolling dialogs}{autoscrollingdialogs} for further details.
a660d684 19
eda9a7d8 20\wxheading{Dialog Buttons}
2f483a69
VZ
21
22The dialog usually contains either a single button allowing to close the
23dialog or two buttons, one accepting the changes and the other one discarding
24them (such button, if present, is automatically activated if the user presses
25the \texttt{"Esc"} key). By default, buttons with the standard \texttt{wxID\_OK}
26and \texttt{wxID\_CANCEL} identifiers behave as expected. Starting with
27wxWidgets 2.7 it is also possible to use a button with a different identifier
28instead, see \helpref{SetAffirmativeId}{wxdialogsetaffirmativeid} and
29\helpref{SetEscapeId}{wxdialogsetescapeid}.
30
31Also notice that the \helpref{CreateButtonSizer()}{wxdialogcreatebuttonsizer}
32should be used to create the buttons appropriate for the current platform and
33positioned correctly (including their order which is platform-dependent).
34
a660d684
KB
35\wxheading{Derived from}
36
834ed994 37\helpref{wxTopLevelWindow}{wxtoplevelwindow}\\
a660d684
KB
38\helpref{wxWindow}{wxwindow}\\
39\helpref{wxEvtHandler}{wxevthandler}\\
40\helpref{wxObject}{wxobject}
41
954b8ae6
JS
42\wxheading{Include files}
43
44<wx/dialog.h>
45
a7af285d
VZ
46\wxheading{Library}
47
48\helpref{wxCore}{librarieslist}
49
eda9a7d8 50\wxheading{Modal and modeless dialogs}
a660d684 51
1e4709b3
VZ
52There are two kinds of dialog -- {\it modal}\ and {\it modeless}. A modal dialog
53blocks program flow and user input on other windows until it is dismissed,
54whereas a modeless dialog behaves more like a frame in that program flow
0032ddbb
JS
55continues, and input in other windows is still possible. To show a modal dialog
56you should use the \helpref{ShowModal}{wxdialogshowmodal} method while to show
57a dialog modelessly you simply use \helpref{Show}{wxdialogshow}, just as with
1e4709b3 58frames.
a660d684 59
0032ddbb 60Note that the modal dialog is one of the very few examples of
1e4709b3 61wxWindow-derived objects which may be created on the stack and not on the heap.
d2c2afc9
JS
62In other words, although this code snippet:
63
1e4709b3
VZ
64\begin{verbatim}
65 void AskUser()
66 {
67 MyAskDialog *dlg = new MyAskDialog(...);
68 if ( dlg->ShowModal() == wxID_OK )
69 ...
70 //else: dialog was cancelled or some another button pressed
a660d684 71
1e4709b3
VZ
72 dlg->Destroy();
73 }
74\end{verbatim}
d2c2afc9 75
1e4709b3
VZ
76works, you can also achieve the same result by using a simpler code fragment
77below:
d2c2afc9 78
1e4709b3
VZ
79\begin{verbatim}
80 void AskUser()
81 {
82 MyAskDialog dlg(...);
83 if ( dlg.ShowModal() == wxID_OK )
84 ...
85
86 // no need to call Destroy() here
87 }
88\end{verbatim}
89
3980000c 90An application can define a \helpref{wxCloseEvent}{wxcloseevent} handler for
1e4709b3 91the dialog to respond to system close events.
a660d684
KB
92
93\wxheading{Window styles}
94
95\twocolwidtha{5cm}
96\begin{twocollist}\itemsep=0pt
f6bcfd97 97\twocolitem{\windowstyle{wxCAPTION}}{Puts a caption on the dialog box.}
850c6ed4 98\twocolitem{\windowstyle{wxDEFAULT\_DIALOG\_STYLE}}{Equivalent to a combination of wxCAPTION, wxCLOSE\_BOX and wxSYSTEM\_MENU (the last one is not used under Unix)}
f6bcfd97 99\twocolitem{\windowstyle{wxRESIZE\_BORDER}}{Display a resizeable frame around the window.}
bbcdf8bc 100\twocolitem{\windowstyle{wxSYSTEM\_MENU}}{Display a system menu.}
850c6ed4 101\twocolitem{\windowstyle{wxCLOSE\_BOX}}{Displays a close box on the frame.}
0032ddbb
JS
102\twocolitem{\windowstyle{wxMAXIMIZE\_BOX}}{Displays a maximize box on the dialog.}
103\twocolitem{\windowstyle{wxMINIMIZE\_BOX}}{Displays a minimize box on the dialog.}
bbcdf8bc 104\twocolitem{\windowstyle{wxTHICK\_FRAME}}{Display a thick frame around the window.}
3faa8195 105\twocolitem{\windowstyle{wxSTAY\_ON\_TOP}}{The dialog stays on top of all other windows.}
a660d684
KB
106\twocolitem{\windowstyle{wxNO\_3D}}{Under Windows, specifies that the child controls
107should not have 3D borders unless specified in the control.}
0032ddbb 108\twocolitem{\windowstyle{wxDIALOG\_NO\_PARENT}}{By default, a dialog created
60fef964 109with a {\tt NULL} parent window will be given the
0032ddbb
JS
110\helpref{application's top level window}{wxappgettopwindow} as parent. Use this
111style to prevent this from happening and create an orphan dialog. This is not recommended for modal dialogs.}
26a80c22 112\twocolitem{\windowstyle{wxDIALOG\_EX\_CONTEXTHELP}}{Under Windows, puts a query button on the
fc2171bd 113caption. When pressed, Windows will go into a context-sensitive help mode and wxWidgets will send
1e4709b3 114a wxEVT\_HELP event if the user clicked on an application window. {\it Note}\ that this is an extended
26a80c22 115style and must be set by calling \helpref{SetExtraStyle}{wxwindowsetextrastyle} before Create is called (two-step construction).}
03d77609 116\twocolitem{\windowstyle{wxDIALOG\_EX\_METAL}}{On Mac OS X, frames with this style will be shown with a metallic look. This is an {\it extra} style.}
a660d684
KB
117\end{twocollist}
118
b3daa5a3 119Under Unix or Linux, MWM (the Motif Window Manager) or other window managers
2edb0bde 120recognizing the MHM hints should be running for any of these styles to have an
b3daa5a3 121effect.
a660d684
KB
122
123See also \helpref{Generic window styles}{windowstyles}.
124
125\wxheading{See also}
126
965b4f87 127\helpref{wxDialog overview}{wxdialogoverview}, \helpref{wxFrame}{wxframe},\rtfsp
a660d684
KB
128\helpref{Validator overview}{validatoroverview}
129
130\latexignore{\rtfignore{\wxheading{Members}}}
131
c6ece595 132
b236c10f 133\membersection{wxDialog::wxDialog}\label{wxdialogctor}
a660d684
KB
134
135\func{}{wxDialog}{\void}
136
137Default constructor.
138
eaaa6a06 139\func{}{wxDialog}{\param{wxWindow* }{parent}, \param{wxWindowID }{id},\rtfsp
a660d684
KB
140\param{const wxString\& }{title},\rtfsp
141\param{const wxPoint\& }{pos = wxDefaultPosition},\rtfsp
142\param{const wxSize\& }{size = wxDefaultSize},\rtfsp
eaaa6a06 143\param{long}{ style = wxDEFAULT\_DIALOG\_STYLE},\rtfsp
a660d684
KB
144\param{const wxString\& }{name = ``dialogBox"}}
145
146Constructor.
147
148\wxheading{Parameters}
149
150\docparam{parent}{Can be NULL, a frame or another dialog box.}
151
152\docparam{id}{An identifier for the dialog. A value of -1 is taken to mean a default.}
153
154\docparam{title}{The title of the dialog.}
155
156\docparam{pos}{The dialog position. A value of (-1, -1) indicates a default position, chosen by
fc2171bd 157either the windowing system or wxWidgets, depending on platform.}
a660d684
KB
158
159\docparam{size}{The dialog size. A value of (-1, -1) indicates a default size, chosen by
fc2171bd 160either the windowing system or wxWidgets, depending on platform.}
a660d684
KB
161
162\docparam{style}{The window style. See \helpref{wxDialog}{wxdialog}.}
163
164\docparam{name}{Used to associate a name with the window,
165allowing the application user to set Motif resource values for
166individual dialog boxes.}
167
168\wxheading{See also}
169
170\helpref{wxDialog::Create}{wxdialogcreate}
171
c6ece595 172
b236c10f 173\membersection{wxDialog::\destruct{wxDialog}}\label{wxdialogdtor}
a660d684
KB
174
175\func{}{\destruct{wxDialog}}{\void}
176
177Destructor. Deletes any child windows before deleting the physical window.
178
3aa8e4ea
JS
179\membersection{wxDialog::AddMainButtonId}\label{wxdialogaddmainbuttonid}
180
181\func{void}{AddMainButtonId}{\param{wxWindowID}{ id}}
182
183Adds an identifier to be regarded as a main button for the non-scrolling area of a dialog.
184
185See also \helpref{Automatic scrolling dialogs}{autoscrollingdialogs} for more on layout adaptation.
186
187\membersection{wxDialog::CanDoLayoutAdaptation}\label{wxdialogcandolayoutadaptation}
188
189\func{bool}{CanDoLayoutAdapation}{\void}
190
191Returns \true if this dialog can and should perform layout adaptation using \helpref{DoLayoutAdaptation}{wxdialogdolayoutadaptation}, usually if
192the dialog is too large to fit on the display.
193
194See also \helpref{Automatic scrolling dialogs}{autoscrollingdialogs} for more on layout adaptation.
c6ece595 195
a660d684
KB
196\membersection{wxDialog::Centre}\label{wxdialogcentre}
197
eaaa6a06 198\func{void}{Centre}{\param{int}{ direction = wxBOTH}}
a660d684
KB
199
200Centres the dialog box on the display.
201
202\wxheading{Parameters}
203
204\docparam{direction}{May be {\tt wxHORIZONTAL}, {\tt wxVERTICAL} or {\tt wxBOTH}.}
205
c6ece595 206
a660d684
KB
207\membersection{wxDialog::Create}\label{wxdialogcreate}
208
eaaa6a06 209\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID }{id},\rtfsp
a660d684
KB
210\param{const wxString\& }{title},\rtfsp
211\param{const wxPoint\& }{pos = wxDefaultPosition},\rtfsp
212\param{const wxSize\& }{size = wxDefaultSize},\rtfsp
eaaa6a06 213\param{long}{ style = wxDEFAULT\_DIALOG\_STYLE},\rtfsp
a660d684
KB
214\param{const wxString\& }{name = ``dialogBox"}}
215
b236c10f 216Used for two-step dialog box construction. See \helpref{wxDialog::wxDialog}{wxdialogctor}\rtfsp
a660d684
KB
217for details.
218
c6ece595 219
67edd0c7
JS
220\membersection{wxDialog::CreateButtonSizer}\label{wxdialogcreatebuttonsizer}
221
222\func{wxSizer*}{CreateButtonSizer}{\param{long}{ flags}}
223
224Creates a sizer with standard buttons. {\it flags} is a bit list
57d7f988
VZ
225of the following flags: wxOK, wxCANCEL, wxYES, wxNO, wxAPPLY, wxCLOSE,
226wxHELP, wxNO\_DEFAULT.
67edd0c7
JS
227
228The sizer lays out the buttons in a manner appropriate to the platform.
229
6500a868
VZ
230This function uses \helpref{CreateStdDialogButtonSizer}{wxdialogcreatestddialogbuttonsizer}
231internally for most platforms but doesn't create the sizer at all for the
232platforms with hardware buttons (such as smartphones) for which it sets up the
233hardware buttons appropriately and returns \NULL, so don't forget to test that
234the return value is valid before using it.
235
236
237\membersection{wxDialog::CreateSeparatedButtonSizer}\label{wxdialogcreateseparatedbuttonsizer}
238
239\func{wxSizer*}{CreateSeparatedButtonSizer}{\param{long}{ flags}}
240
241Creates a sizer with standard buttons using
242\helpref{CreateButtonSizer}{wxdialogcreatebuttonsizer} separated from the rest
243of the dialog contents by a horizontal \helpref{wxStaticLine}{wxstaticline}.
244
245Please notice that just like CreateButtonSizer() this function may return \NULL
246if no buttons were created.
67edd0c7 247
c6ece595 248
67edd0c7
JS
249\membersection{wxDialog::CreateStdDialogButtonSizer}\label{wxdialogcreatestddialogbuttonsizer}
250
251\func{wxStdDialogButtonSizer*}{CreateStdDialogButtonSizer}{\param{long}{ flags}}
252
253Creates a \helpref{wxStdDialogButtonSizer}{wxstddialogbuttonsizer} with standard buttons. {\it flags} is a bit list
57d7f988
VZ
254of the following flags: wxOK, wxCANCEL, wxYES, wxNO, wxAPPLY, wxCLOSE,
255wxHELP, wxNO\_DEFAULT.
67edd0c7
JS
256
257The sizer lays out the buttons in a manner appropriate to the platform.
258
3aa8e4ea
JS
259\membersection{wxDialog::DoLayoutAdaptation}\label{wxdialogdolayoutadaptation}
260
261\func{bool}{DoLayoutAdapation}{\void}
262
263Performs layout adaptation, usually if the dialog is too large to fit on the display.
264
265See also \helpref{Automatic scrolling dialogs}{autoscrollingdialogs} for more on layout adaptation.
c6ece595 266
9ceeecb9
JS
267\membersection{wxDialog::DoOK}\label{wxdialogdook}
268
269\func{virtual bool}{DoOK}{\void}
270
271This function is called when the titlebar OK button is pressed (PocketPC only).
272A command event for the identifier returned by GetAffirmativeId is sent by
273default. You can override this function. If the function returns false, wxWidgets
274will call Close() for the dialog.
275
3aa8e4ea
JS
276\membersection{wxDialog::EnableLayoutAdaptation}\label{wxdialogenablelayoutadaptation}
277
278\func{static void}{EnableLayoutAdaptation}{\param{bool}{ enable}}
279
280A static function enabling or disabling layout adaptation for all dialogs.
281
282See also \helpref{Automatic scrolling dialogs}{autoscrollingdialogs} for more on layout adaptation.
283
c6ece595 284
a660d684
KB
285\membersection{wxDialog::EndModal}\label{wxdialogendmodal}
286
287\func{void}{EndModal}{\param{int }{retCode}}
288
289Ends a modal dialog, passing a value to be returned from the \helpref{wxDialog::ShowModal}{wxdialogshowmodal}\rtfsp
290invocation.
291
292\wxheading{Parameters}
293
294\docparam{retCode}{The value that should be returned by {\bf ShowModal}.}
295
296\wxheading{See also}
297
298\helpref{wxDialog::ShowModal}{wxdialogshowmodal},\rtfsp
6453876e
RR
299\helpref{wxDialog::GetReturnCode}{wxdialoggetreturncode},\rtfsp
300\helpref{wxDialog::SetReturnCode}{wxdialogsetreturncode}
301
c6ece595 302
9ceeecb9
JS
303\membersection{wxDialog::GetAffirmativeId}\label{wxdialoggetaffirmativeid}
304
305\constfunc{int}{GetAffirmativeId}{\void}
306
684e5b95
VZ
307Gets the identifier of the button which works like standard OK button in this
308dialog.
9ceeecb9
JS
309
310\wxheading{See also}
311
312\helpref{wxDialog::SetAffirmativeId}{wxdialogsetaffirmativeid}
313
3aa8e4ea
JS
314\membersection{wxDialog::GetContentWindow}\label{wxdialoggetcontentwindow}
315
316\constfunc{wxWindow*}{GetContentWindow}{\void}
317
318Override this to return a window containing the main content of the dialog. This is
319particularly useful when the dialog implements pages, such as wxPropertySheetDialog,
320and allows the \helpref{layout adaptation code}{wxdialogoverview} to know that only the pages need to be made scrollable.
c6ece595
VZ
321
322\membersection{wxDialog::GetEscapeId}\label{wxdialoggetescapeid}
323
324\constfunc{int}{GetEscapeId}{\void}
325
326Gets the identifier of the button to map presses of \texttt{\textsc{ESC}}
327button to.
328
329\wxheading{See also}
330
331\helpref{wxDialog::SetEscapeId}{wxdialogsetescapeid}
332
333
3aa8e4ea
JS
334\membersection{wxDialog::GetLayoutAdaptationDone}\label{wxdialoggetlayoutadaptationdone}
335
336\constfunc{bool}{GetLayoutAdaptationDone}{\void}
337
338Returns \true if the dialog has been adapted, usually by making it scrollable to work with a small display.
339
340See also \helpref{Automatic scrolling dialogs}{autoscrollingdialogs} for more on layout adaptation.
341
342
343\membersection{wxDialog::GetLayoutAdaptationLevel}\label{wxdialoggetlayoutadaptationlevel}
344
345\func{int}{GetLayoutAdaptationLevel}{\void}
346
347Gets a value representing the aggressiveness of search for buttons and sizers to be in the non-scrolling part of a layout-adapted dialog.
348Zero switches off adaptation, and 3 allows search for standard buttons anywhere in the dialog.
349
350See also \helpref{Automatic scrolling dialogs}{autoscrollingdialogs} for more on layout adaptation.
351
352
353\membersection{wxDialog::GetLayoutAdaptationMode}\label{wxdialoggetlayoutadaptationmode}
354
355\constfunc{wxDialogLayoutAdaptationMode}{GetLayoutAdaptationMode}{\void}
356
357Gets the adaptation mode, overriding the global adaptation flag.
358
359See also \helpref{SetLayoutAdaptationMode}{wxdialogsetlayoutadaptationmode} and \helpref{Automatic scrolling dialogs}{autoscrollingdialogs}.
360
361\membersection{wxDialog::GetLayoutAdapter}\label{wxdialoggetlayoutadapter}
362
363\func{static wxDialogLayoutAdapter*}{GetLayoutAdapter}{\void}
364
365A static function getting the current layout adapter object.
366
367See also \helpref{Automatic scrolling dialogs}{autoscrollingdialogs} for more on layout adaptation.
368
369
370\membersection{wxDialog::GetMainButtonIds}\label{wxdialoggetmainbuttonids}
371
372\func{wxArrayInt\&}{GetMainButtonIds}{\void}
373
374Returns an array of identifiers to be regarded as the main buttons for the non-scrolling area of a dialog.
375
376See also \helpref{Automatic scrolling dialogs}{autoscrollingdialogs} for more on layout adaptation.
377
6453876e
RR
378\membersection{wxDialog::GetReturnCode}\label{wxdialoggetreturncode}
379
380\func{int}{GetReturnCode}{\void}
381
382Gets the return code for this window.
383
384\wxheading{Remarks}
385
386A return code is normally associated with a modal dialog, where \helpref{wxDialog::ShowModal}{wxdialogshowmodal} returns
387a code to the application.
388
389\wxheading{See also}
390
391\helpref{wxDialog::SetReturnCode}{wxdialogsetreturncode}, \helpref{wxDialog::ShowModal}{wxdialogshowmodal},\rtfsp
392\helpref{wxDialog::EndModal}{wxdialogendmodal}
a660d684 393
c6ece595 394
ec5f0c24
JS
395\membersection{wxDialog::GetToolBar}\label{wxdialoggettoolbar}
396
397\constfunc{wxToolBar*}{GetToolBar}{\void}
398
399On PocketPC, a dialog is automatically provided with an empty toolbar. GetToolBar
400allows you to access the toolbar and add tools to it. Removing tools and adding
401arbitrary controls are not currently supported.
402
403This function is not available on any other platform.
404
c6ece595 405
a660d684
KB
406\membersection{wxDialog::Iconize}\label{wxdialogiconized}
407
19f6bff4 408\func{void}{Iconize}{\param{bool}{ iconize}}
a660d684 409
6453876e 410Iconizes or restores the dialog. Windows only.
a660d684
KB
411
412\wxheading{Parameters}
413
cc81d32f 414\docparam{iconize}{If true, iconizes the dialog box; if false, shows and restores it.}
a660d684
KB
415
416\wxheading{Remarks}
417
418Note that in Windows, iconization has no effect since dialog boxes cannot be
419iconized. However, applications may need to explicitly restore dialog
420boxes under Motif which have user-iconizable frames, and under Windows
cc81d32f
VS
421calling {\tt Iconize(false)} will bring the window to the front, as does
422\rtfsp{\tt Show(true)}.
a660d684 423
c6ece595 424
a660d684
KB
425\membersection{wxDialog::IsIconized}\label{wxdialogisiconized}
426
427\constfunc{bool}{IsIconized}{\void}
428
cc81d32f 429Returns true if the dialog box is iconized. Windows only.
a660d684
KB
430
431\wxheading{Remarks}
432
cc81d32f 433Always returns false under Windows since dialogs cannot be iconized.
a660d684 434
c6ece595 435
3aa8e4ea
JS
436\membersection{wxDialog::IsLayoutAdaptationEnabled}\label{wxdialogislayoutadaptationenabled}
437
438\func{static bool}{IsLayoutAdaptationEnabled}{\void}
439
440A static function returning \true if layout adaptation is enabled for all dialogs.
441
442See also \helpref{Automatic scrolling dialogs}{autoscrollingdialogs} for more on layout adaptation.
443
444
445\membersection{wxDialog::IsMainButton}\label{wxdialogismainbutton}
446
447\constfunc{bool}{IsMainButton}{\param{wxWindowID\& }{id}}
448
449Returns \true if {\it id} is in the array of identifiers to be regarded as the main buttons for the non-scrolling area of a dialog.
450
451See also \helpref{Automatic scrolling dialogs}{autoscrollingdialogs} for more on layout adaptation.
452
453
a660d684
KB
454\membersection{wxDialog::IsModal}\label{wxdialogismodal}
455
456\constfunc{bool}{IsModal}{\void}
457
cc81d32f 458Returns true if the dialog box is modal, false otherwise.
a660d684 459
c6ece595 460
c6ece595 461
a660d684
KB
462\membersection{wxDialog::OnSysColourChanged}\label{wxdialogonsyscolourchanged}
463
464\func{void}{OnSysColourChanged}{\param{wxSysColourChangedEvent\& }{event}}
465
466The default handler for wxEVT\_SYS\_COLOUR\_CHANGED.
467
468\wxheading{Parameters}
469
470\docparam{event}{The colour change event.}
471
472\wxheading{Remarks}
473
474Changes the dialog's colour to conform to the current settings (Windows only).
475Add an event table entry for your dialog class if you wish the behaviour
476to be different (such as keeping a user-defined
f4fcc291 477background colour). If you do override this function, call wxEvent::Skip to
a660d684
KB
478propagate the notification to child windows and controls.
479
480\wxheading{See also}
481
482\helpref{wxSysColourChangedEvent}{wxsyscolourchangedevent}
483
c6ece595 484
9ceeecb9
JS
485\membersection{wxDialog::SetAffirmativeId}\label{wxdialogsetaffirmativeid}
486
487\func{void}{SetAffirmativeId}{\param{int }{id}}
488
684e5b95
VZ
489Sets the identifier to be used as OK button. When the button with this
490identifier is pressed, the dialog calls \helpref{Validate}{wxwindowvalidate}
491and \helpref{wxWindow::TransferDataFromWindow}{wxwindowtransferdatafromwindow}
492and, if they both return \true, closes the dialog with \texttt{wxID\_OK} return
493code.
494
495Also, when the user presses a hardware OK button on the devices having one or
496the special OK button in the PocketPC title bar, an event with this id is
497generated.
498
499By default, the affirmative id is wxID\_OK.
9ceeecb9
JS
500
501\wxheading{See also}
502
684e5b95 503\helpref{wxDialog::GetAffirmativeId}{wxdialoggetaffirmativeid}, \helpref{wxDialog::SetEscapeId}{wxdialogsetescapeid}
9ceeecb9 504
c6ece595
VZ
505
506\membersection{wxDialog::SetEscapeId}\label{wxdialogsetescapeid}
507
508\func{void}{SetEscapeId}{\param{int }{id}}
509
684e5b95
VZ
510Sets the identifier of the button which should work like the standard
511\texttt{\textsc{Cancel}} button in this dialog. When the button with this id is
512clicked, the dialog is closed. Also, when the user presses \texttt{\textsc{ESC}}
513key in the dialog or closes the dialog using the close button in the title bar,
514this is mapped to the click of the button with the specified id.
515
516By default, the escape id is the special value \texttt{wxID\_ANY} meaning that
517\texttt{wxID\_CANCEL} button is used if it's present in the dialog and
518otherwise the button with \helpref{GetAffirmativeId()}{wxdialoggetaffirmativeid}
519is used. Another special value for \arg{id} is \texttt{wxID\_NONE} meaning that
520\texttt{\textsc{ESC}} presses should be ignored. If any other value is given, it
c6ece595
VZ
521is interpreted as the id of the button to map the escape key to.
522
523
9a6a5530
MB
524\membersection{wxDialog::SetIcon}\label{wxdialogseticon}
525
526\func{void}{SetIcon}{\param{const wxIcon\& }{icon}}
527
528Sets the icon for this dialog.
529
530\wxheading{Parameters}
531
532\docparam{icon}{The icon to associate with this dialog.}
533
534See also \helpref{wxIcon}{wxicon}.
535
c6ece595 536
9a6a5530
MB
537\membersection{wxDialog::SetIcons}\label{wxdialogseticons}
538
539\func{void}{SetIcons}{\param{const wxIconBundle\& }{icons}}
540
541Sets the icons for this dialog.
542
543\wxheading{Parameters}
544
545\docparam{icons}{The icons to associate with this dialog.}
546
547See also \helpref{wxIconBundle}{wxiconbundle}.
548
c6ece595 549
3aa8e4ea
JS
550\membersection{wxDialog::SetLayoutAdaptationDone}\label{wxdialogsetlayoutadaptationdone}
551
552\func{void}{SetLayoutAdaptationDone}{\param{bool }{done}}
553
554Marks the dialog as having been adapted, usually by making it scrollable to work with a small display.
555
556See also \helpref{Automatic scrolling dialogs}{autoscrollingdialogs} for more on layout adaptation.
557
558
559\membersection{wxDialog::SetLayoutAdaptationLevel}\label{wxdialogsetlayoutadaptationlevel}
560
561\func{void}{SetLayoutAdaptationLevel}{\param{int }{level}}
562
563Sets the aggressiveness of search for buttons and sizers to be in the non-scrolling part of a layout-adapted dialog.
564Zero switches off adaptation, and 3 allows search for standard buttons anywhere in the dialog.
565
566See also \helpref{Automatic scrolling dialogs}{autoscrollingdialogs} for more on layout adaptation.
567
568
569\membersection{wxDialog::SetLayoutAdaptationMode}\label{wxdialogsetlayoutadaptationmode}
570
571\func{void}{SetLayoutAdaptationMode}{\param{wxDialogLayoutAdaptationMode }{mode}}
572
573Sets the adaptation mode, overriding the global adaptation flag. {\it mode} may be one of the following values:
574
575\begin{verbatim}
576enum wxDialogLayoutAdaptationMode
577{
578 wxDIALOG_ADAPTATION_MODE_DEFAULT = 0, // use global adaptation enabled status
579 wxDIALOG_ADAPTATION_MODE_ENABLED = 1, // enable this dialog overriding global status
580 wxDIALOG_ADAPTATION_MODE_DISABLED = 2 // disable this dialog overriding global status
581};
582\end{verbatim}
583
584See also \helpref{Automatic scrolling dialogs}{autoscrollingdialogs} for more on layout adaptation.
585
586
587\membersection{wxDialog::SetLayoutAdapter}\label{wxdialogsetlayoutadapter}
588
589\func{static wxDialogLayoutAdapter*}{SetLayoutAdapter}{\param{wxDialogLayoutAdapter*}{ adapter}}
590
591A static function for setting the current layout adapter object, returning the old adapter. If you call this, you should
592delete the old adapter object.
593
594See also \helpref{wxDialogLayoutAdapter}{wxdialoglayoutadapter} and \helpref{Automatic scrolling dialogs}{autoscrollingdialogs}.
595
596
a660d684
KB
597\membersection{wxDialog::SetModal}\label{wxdialogsetmodal}
598
19f6bff4 599\func{void}{SetModal}{\param{bool}{ flag}}
a660d684 600
60fef964 601{\bf NB:} This function is deprecated and doesn't work for all ports, just use
f6bcfd97
BP
602\helpref{ShowModal}{wxdialogshowmodal} to show a modal dialog instead.
603
a660d684
KB
604Allows the programmer to specify whether the dialog box is modal (wxDialog::Show blocks control
605until the dialog is hidden) or modeless (control returns immediately).
606
607\wxheading{Parameters}
608
cc81d32f 609\docparam{flag}{If true, the dialog will be modal, otherwise it will be modeless.}
a660d684 610
c6ece595 611
6453876e
RR
612\membersection{wxDialog::SetReturnCode}\label{wxdialogsetreturncode}
613
614\func{void}{SetReturnCode}{\param{int }{retCode}}
615
616Sets the return code for this window.
617
618\wxheading{Parameters}
619
620\docparam{retCode}{The integer return code, usually a control identifier.}
621
622\wxheading{Remarks}
623
624A return code is normally associated with a modal dialog, where \helpref{wxDialog::ShowModal}{wxdialogshowmodal} returns
625a code to the application. The function \helpref{wxDialog::EndModal}{wxdialogendmodal} calls {\bf SetReturnCode}.
626
627\wxheading{See also}
628
d7cb14ce 629\helpref{wxDialog::GetReturnCode}{wxdialoggetreturncode}, \helpref{wxDialog::ShowModal}{wxdialogshowmodal},\rtfsp
6453876e
RR
630\helpref{wxDialog::EndModal}{wxdialogendmodal}
631
c6ece595 632
a660d684
KB
633\membersection{wxDialog::Show}\label{wxdialogshow}
634
19f6bff4 635\func{bool}{Show}{\param{bool}{ show}}
a660d684
KB
636
637Hides or shows the dialog.
638
639\wxheading{Parameters}
640
cc81d32f
VS
641\docparam{show}{If true, the dialog box is shown and brought to the front;
642otherwise the box is hidden. If false and the dialog is
a660d684
KB
643modal, control is returned to the calling program.}
644
645\wxheading{Remarks}
646
647The preferred way of dismissing a modal dialog is to use \helpref{wxDialog::EndModal}{wxdialogendmodal}.
648
c6ece595 649
a660d684
KB
650\membersection{wxDialog::ShowModal}\label{wxdialogshowmodal}
651
652\func{int}{ShowModal}{\void}
653
654Shows a modal dialog. Program flow does not return until the dialog has been dismissed with\rtfsp
655\helpref{wxDialog::EndModal}{wxdialogendmodal}.
656
657\wxheading{Return value}
658
d7cb14ce 659The return value is the value set with \helpref{wxDialog::SetReturnCode}{wxdialogsetreturncode}.
a660d684
KB
660
661\wxheading{See also}
662
663\helpref{wxDialog::EndModal}{wxdialogendmodal},\rtfsp
d7cb14ce
JS
664\helpref{wxDialog:GetReturnCode}{wxdialoggetreturncode},\rtfsp
665\helpref{wxDialog::SetReturnCode}{wxdialogsetreturncode}
b67a86d5 666