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