]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/sngchdlg.tex
added null pointer check and assert
[wxWidgets.git] / docs / latex / wx / sngchdlg.tex
CommitLineData
a660d684
KB
1\section{\class{wxSingleChoiceDialog}}\label{wxsinglechoicedialog}
2
b70b68a9
VS
3This class represents a dialog that shows a list of strings, and allows the
4user to select one. Double-clicking on a list item is equivalent to
5single-clicking and then pressing OK.
a660d684
KB
6
7\wxheading{Derived from}
8
9\helpref{wxDialog}{wxdialog}\\
7376079d 10\helpref{wxTopLevelWindow}{wxtoplevelwindow}\\
a660d684
KB
11\helpref{wxWindow}{wxwindow}\\
12\helpref{wxEvtHandler}{wxevthandler}\\
13\helpref{wxObject}{wxobject}
14
954b8ae6
JS
15\wxheading{Include files}
16
17<wx/choicdlg.h>
18
a660d684
KB
19\wxheading{See also}
20
b70b68a9
VS
21\helpref{wxSingleChoiceDialog overview}{wxsinglechoicedialogoverview},
22\helpref{wxMultiChoiceDialog}{wxmultichoicedialog}
a660d684
KB
23
24\latexignore{\rtfignore{\wxheading{Members}}}
25
08f1d438 26\membersection{wxSingleChoiceDialog::wxSingleChoiceDialog}\label{wxsinglechoicedialogctor}
a660d684
KB
27
28\func{}{wxSingleChoiceDialog}{\param{wxWindow* }{parent}, \param{const wxString\& }{message},\rtfsp
eaaa6a06 29\param{const wxString\& }{caption}, \param{int }{n}, \param{const wxString* }{choices},\rtfsp
b70b68a9 30\param{void**}{ clientData = NULL}, \param{long }{style = wxCHOICEDLG\_STYLE},\rtfsp
a660d684
KB
31\param{const wxPoint\& }{pos = wxDefaultPosition}}
32
b70b68a9
VS
33\func{}{wxSingleChoiceDialog}{\param{wxWindow* }{parent}, \param{const wxString\& }{message},\rtfsp
34\param{const wxString\& }{caption}, \param{const wxArrayString\& }{choices},\rtfsp
35\param{void**}{ clientData = NULL}, \param{long }{style = wxCHOICEDLG\_STYLE},\rtfsp
36\param{const wxPoint\& }{pos = wxDefaultPosition}}
a660d684 37
b70b68a9 38Constructor, taking an array of wxString choices and optional client data.
a660d684
KB
39
40\wxheading{Parameters}
41
42\docparam{parent}{Parent window.}
43
44\docparam{message}{Message to show on the dialog.}
45
46\docparam{caption}{The dialog caption.}
47
48\docparam{n}{The number of choices.}
49
50\docparam{choices}{An array of strings, or a string list, containing the choices.}
51
b70b68a9
VS
52\docparam{clientData}{An array of client data to be associated with the items.
53See \helpref{GetSelectionClientData}{wxsinglechoicedialoggetselectionclientdata}.}
54
55\docparam{style}{A dialog style (bitlist) containing flags chosen from standard
56dialog styles and the following:
a660d684
KB
57
58\twocolwidtha{5cm}
59\begin{twocollist}
60\twocolitem{{\bf wxOK}}{Show an OK button.}
61\twocolitem{{\bf wxCANCEL}}{Show a Cancel button.}
62\twocolitem{{\bf wxCENTRE}}{Centre the message. Not Windows.}
63\end{twocollist}
b70b68a9 64The default value is equivalent to {\bf wxDEFAULT\_DIALOG\_STYLE \pipe wxRESIZE\_BORDER \pipe wxOK \pipe wxCANCEL \pipe wxCENTRE}.
a660d684
KB
65}
66
67\docparam{pos}{Dialog position. Not Windows.}
68
69\wxheading{Remarks}
70
71Use \helpref{wxSingleChoiceDialog::ShowModal}{wxsinglechoicedialogshowmodal} to show the dialog.
72
2edb0bde 73\pythonnote{For Python the two parameters {\tt n} and {\tt choices} are collapsed
8771a323 74into a single parameter {\tt choices} which is expected to be a Python
3e02f5ed 75list of strings.}
a660d684 76
f3539882
VZ
77\perlnote{In wxPerl there is just an array reference in place of {\tt n}
78and {\tt choices}, and the client data array, if present, must have the
79same length as the choices array.}
80
08f1d438 81\membersection{wxSingleChoiceDialog::GetSelection}\label{wxsinglechoicedialoggetselection}
a660d684
KB
82
83\constfunc{int}{GetSelection}{\void}
84
85Returns the index of selected item.
86
b70b68a9 87\membersection{wxSingleChoiceDialog::GetSelectionClientData}\label{wxsinglechoicedialoggetselectionclientdata}
a660d684
KB
88
89\constfunc{char*}{GetSelectionClientData}{\void}
90
91Returns the client data associated with the selection.
92
08f1d438 93\membersection{wxSingleChoiceDialog::GetStringSelection}\label{wxsinglechoicedialoggetstringselection}
a660d684
KB
94
95\constfunc{wxString}{GetStringSelection}{\void}
96
97Returns the selected string.
98
08f1d438 99\membersection{wxSingleChoiceDialog::SetSelection}\label{wxsinglechoicedialogsetselection}
44178d92
VZ
100
101\constfunc{void}{SetSelection}{\param{int}{ selection}}
102
103Sets the index of the initially selected item.
104
a660d684
KB
105\membersection{wxSingleChoiceDialog::ShowModal}\label{wxsinglechoicedialogshowmodal}
106
107\func{int}{ShowModal}{\void}
108
109Shows the dialog, returning either wxID\_OK or wxID\_CANCEL.
110