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