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