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