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