]>
Commit | Line | Data |
---|---|---|
a660d684 KB |
1 | \section{\class{wxRadioBox}}\label{wxradiobox} |
2 | ||
3 | A radio box item is used to select one of number of mutually exclusive | |
4 | choices. It is displayed as a vertical column or horizontal row of | |
5 | labelled buttons. | |
6 | ||
7 | \wxheading{Derived from} | |
8 | ||
9 | \helpref{wxControl}{wxcontrol}\\ | |
10 | \helpref{wxWindow}{wxwindow}\\ | |
11 | \helpref{wxEvtHandler}{wxevthandler}\\ | |
12 | \helpref{wxObject}{wxobject} | |
13 | ||
954b8ae6 JS |
14 | \wxheading{Include files} |
15 | ||
16 | <wx/radiobox.h> | |
17 | ||
a660d684 KB |
18 | \wxheading{Window styles} |
19 | ||
20 | \twocolwidtha{5cm} | |
21 | \begin{twocollist}\itemsep=0pt | |
94b49b93 JS |
22 | \twocolitem{\windowstyle{wxRA\_SPECIFY\_ROWS}}{The major dimension parameter refers to the |
23 | maximum number of rows.} | |
24 | \twocolitem{\windowstyle{wxRA\_SPECIFY\_COLS}}{The major dimension parameter refers to the | |
25 | maximum number of columns.} | |
bcf576cc WS |
26 | \twocolitem{\windowstyle{wxRA\_USE\_CHECKBOX}}{Use of the checkbox controls instead of radio |
27 | buttons (currently supported only on PalmOS)} | |
a660d684 KB |
28 | \end{twocollist} |
29 | ||
30 | See also \helpref{window styles overview}{windowstyles}. | |
31 | ||
5de76427 JS |
32 | \wxheading{Event handling} |
33 | ||
34 | \twocolwidtha{7cm} | |
35 | \begin{twocollist}\itemsep=0pt | |
36 | \twocolitem{{\bf EVT\_RADIOBOX(id, func)}}{Process a wxEVT\_COMMAND\_RADIOBOX\_SELECTED event, | |
37 | when a radiobutton is clicked.} | |
38 | \end{twocollist} | |
39 | ||
a660d684 KB |
40 | \wxheading{See also} |
41 | ||
42 | \helpref{Event handling overview}{eventhandlingoverview}, \helpref{wxRadioButton}{wxradiobutton},\rtfsp | |
43 | \helpref{wxCheckBox}{wxcheckbox} | |
44 | ||
45 | \latexignore{\rtfignore{\wxheading{Members}}} | |
46 | ||
3e79fa75 | 47 | \membersection{wxRadioBox::wxRadioBox}\label{wxradioboxctor} |
a660d684 KB |
48 | |
49 | \func{}{wxRadioBox}{\void} | |
50 | ||
51 | Default constructor. | |
52 | ||
eaaa6a06 | 53 | \func{}{wxRadioBox}{\param{wxWindow* }{parent}, \param{wxWindowID }{id}, \param{const wxString\& }{label},\rtfsp |
a660d684 | 54 | \param{const wxPoint\& }{point = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp |
eaaa6a06 | 55 | \param{int}{ n = 0}, \param{const wxString}{ choices[] = NULL},\rtfsp |
94b49b93 | 56 | \param{int}{ majorDimension = 0}, \param{long}{ style = wxRA\_SPECIFY\_COLS},\rtfsp |
a660d684 KB |
57 | \param{const wxValidator\& }{validator = wxDefaultValidator},\rtfsp |
58 | \param{const wxString\& }{name = ``radioBox"}} | |
59 | ||
56b88f12 MB |
60 | \func{}{wxRadioBox}{\param{wxWindow* }{parent}, \param{wxWindowID }{id}, \param{const wxString\& }{label},\rtfsp |
61 | \param{const wxPoint\& }{point}, \param{const wxSize\& }{size},\rtfsp | |
62 | \param{const wxArrayString\&}{ choices},\rtfsp | |
63 | \param{int}{ majorDimension = 0}, \param{long}{ style = wxRA\_SPECIFY\_COLS},\rtfsp | |
64 | \param{const wxValidator\& }{validator = wxDefaultValidator},\rtfsp | |
65 | \param{const wxString\& }{name = ``radioBox"}} | |
66 | ||
a660d684 KB |
67 | Constructor, creating and showing a radiobox. |
68 | ||
69 | \wxheading{Parameters} | |
70 | ||
71 | \docparam{parent}{Parent window. Must not be NULL.} | |
72 | ||
73 | \docparam{id}{Window identifier. A value of -1 indicates a default value.} | |
74 | ||
75 | \docparam{label}{Label for the static box surrounding the radio buttons.} | |
76 | ||
77 | \docparam{pos}{Window position. If the position (-1, -1) is specified then a default position is chosen.} | |
78 | ||
79 | \docparam{size}{Window size. If the default size (-1, -1) is specified then a default size is chosen.} | |
80 | ||
81 | \docparam{n}{Number of choices with which to initialize the radiobox.} | |
82 | ||
83 | \docparam{choices}{An array of choices with which to initialize the radiobox.} | |
84 | ||
94b49b93 | 85 | \docparam{majorDimension}{Specifies the maximum number of rows (if style contains wxRA\_SPECIFY\_ROWS) or columns (if style contains wxRA\_SPECIFY\_COLS) for a two-dimensional |
a660d684 KB |
86 | radiobox.} |
87 | ||
88 | \docparam{style}{Window style. See \helpref{wxRadioBox}{wxradiobox}.} | |
89 | ||
90 | \docparam{validator}{Window validator.} | |
91 | ||
92 | \docparam{name}{Window name.} | |
93 | ||
94 | \wxheading{See also} | |
95 | ||
96 | \helpref{wxRadioBox::Create}{wxradioboxcreate}, \helpref{wxValidator}{wxvalidator} | |
97 | ||
c9110876 VS |
98 | \pythonnote{The wxRadioBox constructor in wxPython reduces the {\tt n} |
99 | and {\tt choices} arguments are to a single argument, which is | |
06d20283 RD |
100 | a list of strings.} |
101 | ||
5873607e VZ |
102 | \perlnote{In wxPerl there is just an array reference in place of {\tt n} |
103 | and {\tt choices}.} | |
06d20283 | 104 | |
3e79fa75 | 105 | \membersection{wxRadioBox::\destruct{wxRadioBox}}\label{wxradioboxdtor} |
a660d684 KB |
106 | |
107 | \func{}{\destruct{wxRadioBox}}{\void} | |
108 | ||
109 | Destructor, destroying the radiobox item. | |
110 | ||
111 | \membersection{wxRadioBox::Create}\label{wxradioboxcreate} | |
112 | ||
eaaa6a06 | 113 | \func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID }{id}, \param{const wxString\& }{label},\rtfsp |
a660d684 | 114 | \param{const wxPoint\& }{point = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp |
eaaa6a06 | 115 | \param{int}{ n = 0}, \param{const wxString}{ choices[] = NULL},\rtfsp |
94b49b93 | 116 | \param{int}{ majorDimension = 0}, \param{long}{ style = wxRA\_SPECIFY\_COLS},\rtfsp |
a660d684 | 117 | \param{const wxValidator\& }{validator = wxDefaultValidator},\rtfsp |
56b88f12 MB |
118 | \param{const wxString\& }{name = ``radioBox"}} |
119 | ||
120 | \func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID }{id}, \param{const wxString\& }{label},\rtfsp | |
121 | \param{const wxPoint\& }{point}, \param{const wxSize\& }{size},\rtfsp | |
122 | \param{const wxArrayString\&}{ choices},\rtfsp | |
123 | \param{int}{ majorDimension = 0}, \param{long}{ style = wxRA\_SPECIFY\_COLS},\rtfsp | |
124 | \param{const wxValidator\& }{validator = wxDefaultValidator},\rtfsp | |
a660d684 KB |
125 | \param{const wxString\& }{name = ``radioBox"}} |
126 | ||
3e79fa75 | 127 | Creates the radiobox for two-step construction. See \helpref{wxRadioBox::wxRadioBox}{wxradioboxctor}\rtfsp |
a660d684 KB |
128 | for further details. |
129 | ||
130 | \membersection{wxRadioBox::Enable}\label{wxradioboxenable} | |
131 | ||
cc81d32f | 132 | \func{void}{Enable}{\param{bool}{ enable = {\tt true}}} |
a660d684 KB |
133 | |
134 | Enables or disables the entire radiobox. | |
135 | ||
cc81d32f | 136 | \func{void}{Enable}{\param{int}{ n}, \param{bool}{ enable = {\tt true}}} |
a660d684 KB |
137 | |
138 | Enables or disables an individual button in the radiobox. | |
139 | ||
140 | \wxheading{Parameters} | |
141 | ||
cc81d32f | 142 | \docparam{enable}{true to enable, false to disable.} |
a660d684 KB |
143 | |
144 | \docparam{n}{The zero-based button to enable or disable.} | |
145 | ||
21f280f4 RD |
146 | \pythonnote{In place of a single overloaded method name, wxPython |
147 | implements the following methods:\par | |
148 | \indented{2cm}{\begin{twocollist} | |
c9110876 VS |
149 | \twocolitem{{\bf Enable(flag)}}{Enables or disables the entire radiobox.} |
150 | \twocolitem{{\bf EnableItem(n, flag)}}{Enables or disables an | |
21f280f4 RD |
151 | individual button in the radiobox.} |
152 | \end{twocollist}} | |
153 | } | |
154 | ||
155 | ||
a660d684 KB |
156 | \membersection{wxRadioBox::FindString}\label{wxradioboxfindstring} |
157 | ||
158 | \constfunc{int}{FindString}{\param{const wxString\& }{string}} | |
159 | ||
160 | Finds a button matching the given string, returning the position if found, or | |
161 | -1 if not found. | |
162 | ||
163 | \wxheading{Parameters} | |
164 | ||
165 | \docparam{string}{The string to find.} | |
166 | ||
28ca7610 VZ |
167 | \membersection{wxRadioBox::GetCount}\label{wxradioboxgetcount} |
168 | ||
169 | \constfunc{int}{GetCount}{\void} | |
170 | ||
171 | Returns the number of items in the radiobox. | |
172 | ||
a660d684 KB |
173 | \membersection{wxRadioBox::GetLabel}\label{wxradioboxgetlabel} |
174 | ||
175 | \constfunc{wxString}{GetLabel}{\void} | |
176 | ||
177 | Returns the radiobox label. | |
178 | ||
a660d684 KB |
179 | \wxheading{Parameters} |
180 | ||
181 | \docparam{n}{The zero-based button index.} | |
182 | ||
183 | \wxheading{See also} | |
184 | ||
185 | \helpref{wxRadioBox::SetLabel}{wxradioboxsetlabel} | |
186 | ||
21f280f4 RD |
187 | \pythonnote{In place of a single overloaded method name, wxPython |
188 | implements the following methods:\par | |
189 | \indented{2cm}{\begin{twocollist} | |
c9110876 VS |
190 | \twocolitem{{\bf GetLabel()}}{Returns the radiobox label.} |
191 | \twocolitem{{\bf GetItemLabel(n)}}{Returns the label for the given button.} | |
21f280f4 RD |
192 | \end{twocollist}} |
193 | } | |
194 | ||
195 | ||
a660d684 KB |
196 | \membersection{wxRadioBox::GetSelection}\label{wxradioboxgetselection} |
197 | ||
198 | \constfunc{int}{GetSelection}{\void} | |
199 | ||
200 | Returns the zero-based position of the selected button. | |
201 | ||
202 | \membersection{wxRadioBox::GetStringSelection}\label{wxradioboxgetstringselection} | |
203 | ||
204 | \constfunc{wxString}{GetStringSelection}{\void} | |
205 | ||
206 | Returns the selected string. | |
207 | ||
d61c1a6f JS |
208 | \membersection{wxRadioBox::GetString}\label{wxradioboxgetstring} |
209 | ||
210 | \constfunc{wxString}{GetString}{\param{int}{ n}} | |
211 | ||
212 | Returns the label for the button at the given position. | |
213 | ||
214 | \wxheading{Parameters} | |
215 | ||
216 | \docparam{n}{The zero-based button position.} | |
217 | ||
a660d684 KB |
218 | \membersection{wxRadioBox::Number}\label{wxradioboxnumber} |
219 | ||
220 | \constfunc{int}{Number}{\void} | |
221 | ||
bcf576cc | 222 | {\bf Obsolescence note:} This method is obsolete and was replaced with |
e676441f | 223 | \helpref{GetCount}{wxradioboxgetcount}, please use the new method in the new |
bcf576cc | 224 | code. This method is only available if wxWidgets was compiled with |
28ca7610 VZ |
225 | {\tt WXWIN\_COMPATIBILITY\_2\_2} defined and will disappear completely in |
226 | future versions. | |
227 | ||
a660d684 KB |
228 | Returns the number of buttons in the radiobox. |
229 | ||
230 | \membersection{wxRadioBox::SetLabel}\label{wxradioboxsetlabel} | |
231 | ||
232 | \func{void}{SetLabel}{\param{const wxString\&}{ label}} | |
233 | ||
234 | Sets the radiobox label. | |
235 | ||
a660d684 KB |
236 | |
237 | \wxheading{Parameters} | |
238 | ||
239 | \docparam{label}{The label to set.} | |
240 | ||
241 | \docparam{n}{The zero-based button index.} | |
242 | ||
21f280f4 RD |
243 | \pythonnote{In place of a single overloaded method name, wxPython |
244 | implements the following methods:\par | |
245 | \indented{2cm}{\begin{twocollist} | |
c9110876 VS |
246 | \twocolitem{{\bf SetLabel(string)}}{Sets the radiobox label.} |
247 | \twocolitem{{\bf SetItemLabel(n, string)}}{Sets a label for a radio button.} | |
21f280f4 RD |
248 | \end{twocollist}} |
249 | } | |
250 | ||
a660d684 KB |
251 | \membersection{wxRadioBox::SetSelection}\label{wxradioboxsetselection} |
252 | ||
eaaa6a06 | 253 | \func{void}{SetSelection}{\param{int}{ n}} |
a660d684 | 254 | |
953704c1 RR |
255 | Sets a button by passing the desired string position. This does not cause |
256 | a wxEVT\_COMMAND\_RADIOBOX\_SELECTED event to get emitted. | |
a660d684 KB |
257 | |
258 | \wxheading{Parameters} | |
259 | ||
260 | \docparam{n}{The zero-based button position.} | |
261 | ||
262 | \membersection{wxRadioBox::SetStringSelection}\label{wxradioboxsetstringselection} | |
263 | ||
264 | \func{void}{SetStringSelection}{\param{const wxString\& }{string}} | |
265 | ||
953704c1 RR |
266 | Sets the selection to a button by passing the desired string. This does not cause |
267 | a wxEVT\_COMMAND\_RADIOBOX\_SELECTED event to get emitted. | |
a660d684 KB |
268 | |
269 | \wxheading{Parameters} | |
270 | ||
271 | \docparam{string}{The label of the button to select.} | |
272 | ||
273 | \membersection{wxRadioBox::Show}\label{wxradioboxshow} | |
274 | ||
275 | \func{void}{Show}{\param{const bool}{ show}} | |
276 | ||
277 | Shows or hides the entire radiobox. | |
278 | ||
eaaa6a06 | 279 | \func{void}{Show}{\param{int }{item}, \param{const bool}{ show}} |
a660d684 KB |
280 | |
281 | Shows or hides individual buttons. | |
282 | ||
283 | \wxheading{Parameters} | |
284 | ||
cc81d32f | 285 | \docparam{show}{true to show, false to hide.} |
a660d684 KB |
286 | |
287 | \docparam{item}{The zero-based position of the button to show or hide.} | |
288 | ||
21f280f4 RD |
289 | \pythonnote{In place of a single overloaded method name, wxPython |
290 | implements the following methods:\par | |
291 | \indented{2cm}{\begin{twocollist} | |
c9110876 VS |
292 | \twocolitem{{\bf Show(flag)}}{Shows or hides the entire radiobox.} |
293 | \twocolitem{{\bf ShowItem(n, flag)}}{Shows or hides individual buttons.} | |
21f280f4 RD |
294 | \end{twocollist}} |
295 | } | |
296 |