]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/radiobox.tex
Tweaks for demos on MacOSX
[wxWidgets.git] / docs / latex / wx / radiobox.tex
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
9 %% License: wxWindows license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
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
25 \wxheading{Include files}
26
27 <wx/radiobox.h>
28
29 \wxheading{Window styles}
30
31 \twocolwidtha{5cm}
32 \begin{twocollist}\itemsep=0pt
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.}
37 \twocolitem{\windowstyle{wxRA\_USE\_CHECKBOX}}{Use of the checkbox controls instead of radio
38 buttons (currently supported only on PalmOS)}
39 \end{twocollist}
40
41 See also \helpref{window styles overview}{windowstyles}.
42
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
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
58
59 \membersection{wxRadioBox::wxRadioBox}\label{wxradioboxctor}
60
61 \func{}{wxRadioBox}{\void}
62
63 Default constructor.
64
65 \func{}{wxRadioBox}{\param{wxWindow* }{parent}, \param{wxWindowID }{id}, \param{const wxString\& }{label},\rtfsp
66 \param{const wxPoint\& }{point = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
67 \param{int}{ n = 0}, \param{const wxString}{ choices[] = NULL},\rtfsp
68 \param{int}{ majorDimension = 0}, \param{long}{ style = wxRA\_SPECIFY\_COLS},\rtfsp
69 \param{const wxValidator\& }{validator = wxDefaultValidator},\rtfsp
70 \param{const wxString\& }{name = ``radioBox"}}
71
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
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
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
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
110 \pythonnote{The wxRadioBox constructor in wxPython reduces the {\tt n}
111 and {\tt choices} arguments are to a single argument, which is
112 a list of strings.}
113
114 \perlnote{In wxPerl there is just an array reference in place of {\tt n}
115 and {\tt choices}.}
116
117
118 \membersection{wxRadioBox::\destruct{wxRadioBox}}\label{wxradioboxdtor}
119
120 \func{}{\destruct{wxRadioBox}}{\void}
121
122 Destructor, destroying the radiobox item.
123
124
125 \membersection{wxRadioBox::Create}\label{wxradioboxcreate}
126
127 \func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID }{id}, \param{const wxString\& }{label},\rtfsp
128 \param{const wxPoint\& }{point = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
129 \param{int}{ n = 0}, \param{const wxString}{ choices[] = NULL},\rtfsp
130 \param{int}{ majorDimension = 0}, \param{long}{ style = wxRA\_SPECIFY\_COLS},\rtfsp
131 \param{const wxValidator\& }{validator = wxDefaultValidator},\rtfsp
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
139 \param{const wxString\& }{name = ``radioBox"}}
140
141 Creates the radiobox for two-step construction. See \helpref{wxRadioBox::wxRadioBox}{wxradioboxctor}\rtfsp
142 for further details.
143
144
145 \membersection{wxRadioBox::Enable}\label{wxradioboxenable}
146
147 \func{virtual bool}{Enable}{\param{bool}{ enable = {\tt true}}}
148
149 Enables or disables the entire radiobox.
150
151 \func{virtual bool}{Enable}{\param{int}{ n}, \param{bool}{ enable = {\tt true}}}
152
153 Enables or disables an individual button in the radiobox.
154
155 \wxheading{Parameters}
156
157 \docparam{enable}{true to enable, false to disable.}
158
159 \docparam{n}{The zero-based button to enable or disable.}
160
161 \pythonnote{In place of a single overloaded method name, wxPython
162 implements the following methods:\par
163 \indented{2cm}{\begin{twocollist}
164 \twocolitem{{\bf Enable(flag)}}{Enables or disables the entire radiobox.}
165 \twocolitem{{\bf EnableItem(n, flag)}}{Enables or disables an
166 individual button in the radiobox.}
167 \end{twocollist}}
168 }
169
170 \wxheading{See also}
171
172 \helpref{wxWindow::Enable}{wxwindowenable}
173
174
175
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
187
188 \membersection{wxRadioBox::GetColumnCount}\label{wxradioboxgetcolumncount}
189
190 \constfunc{int}{GetColumnCount}{\void}
191
192 Returns the number of columns in the radiobox.
193
194
195 \membersection{wxRadioBox::GetCount}\label{wxradioboxgetcount}
196
197 \constfunc{int}{GetCount}{\void}
198
199 Returns the number of items in the radiobox.
200
201
202 \membersection{wxRadioBox::GetLabel}\label{wxradioboxgetlabel}
203
204 \constfunc{wxString}{GetLabel}{\void}
205
206 Returns the radiobox label.
207
208 \wxheading{Parameters}
209
210 \docparam{n}{The zero-based button index.}
211
212 \wxheading{See also}
213
214 \helpref{wxRadioBox::SetLabel}{wxradioboxsetlabel}
215
216 \pythonnote{In place of a single overloaded method name, wxPython
217 implements the following methods:\par
218 \indented{2cm}{\begin{twocollist}
219 \twocolitem{{\bf GetLabel()}}{Returns the radiobox label.}
220 \twocolitem{{\bf GetItemLabel(n)}}{Returns the label for the given button.}
221 \end{twocollist}}
222 }
223
224
225 \membersection{wxRadioBox::GetRowCount}\label{wxradioboxgetrowcount}
226
227 \constfunc{int}{GetRowCount}{\void}
228
229 Returns the number of rows in the radiobox.
230
231
232 \membersection{wxRadioBox::GetSelection}\label{wxradioboxgetselection}
233
234 \constfunc{int}{GetSelection}{\void}
235
236 Returns the zero-based position of the selected button.
237
238
239 \membersection{wxRadioBox::GetStringSelection}\label{wxradioboxgetstringselection}
240
241 \constfunc{wxString}{GetStringSelection}{\void}
242
243 Returns the selected string.
244
245
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
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
264 {\bf Platform note:} Currently only implemented in wxMSW, wxGTK and wxUniversal
265 and always returns \true in the other ports.
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
278 {\bf Platform note:} Currently only implemented in wxMSW, wxGTK and wxUniversal
279 and always returns \true in the other ports.
280
281
282 \membersection{wxRadioBox::Number}\label{wxradioboxnumber}
283
284 \constfunc{int}{Number}{\void}
285
286 {\bf Obsolescence note:} This method is obsolete and was replaced with
287 \helpref{GetCount}{wxradioboxgetcount}, please use the new method in the new
288 code. This method is only available if wxWidgets was compiled with
289 {\tt WXWIN\_COMPATIBILITY\_2\_2} defined and will disappear completely in
290 future versions.
291
292 Returns the number of buttons in the radiobox.
293
294
295 \membersection{wxRadioBox::SetLabel}\label{wxradioboxsetlabel}
296
297 \func{void}{SetLabel}{\param{const wxString\&}{ label}}
298
299 Sets the radiobox label.
300
301
302 \wxheading{Parameters}
303
304 \docparam{label}{The label to set.}
305
306 \docparam{n}{The zero-based button index.}
307
308 \pythonnote{In place of a single overloaded method name, wxPython
309 implements the following methods:\par
310 \indented{2cm}{\begin{twocollist}
311 \twocolitem{{\bf SetLabel(string)}}{Sets the radiobox label.}
312 \twocolitem{{\bf SetItemLabel(n, string)}}{Sets a label for a radio button.}
313 \end{twocollist}}
314 }
315
316
317 \membersection{wxRadioBox::SetSelection}\label{wxradioboxsetselection}
318
319 \func{void}{SetSelection}{\param{int}{ n}}
320
321 Sets a button by passing the desired string position. This does not cause
322 a wxEVT\_COMMAND\_RADIOBOX\_SELECTED event to get emitted.
323
324 \wxheading{Parameters}
325
326 \docparam{n}{The zero-based button position.}
327
328
329 \membersection{wxRadioBox::SetStringSelection}\label{wxradioboxsetstringselection}
330
331 \func{void}{SetStringSelection}{\param{const wxString\& }{string}}
332
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.
335
336 \wxheading{Parameters}
337
338 \docparam{string}{The label of the button to select.}
339
340
341 \membersection{wxRadioBox::Show}\label{wxradioboxshow}
342
343 \func{virtual bool}{Show}{\param{const bool}{ show = {\tt true}}}
344
345 Shows or hides the entire radiobox.
346
347 \func{virtual bool}{Show}{\param{int}{ item}, \param{const bool}{ show = {\tt true}}}
348
349 Shows or hides individual buttons.
350
351 \wxheading{Parameters}
352
353 \docparam{show}{true to show, false to hide.}
354
355 \docparam{item}{The zero-based position of the button to show or hide.}
356
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
366 \pythonnote{In place of a single overloaded method name, wxPython
367 implements the following methods:\par
368 \indented{2cm}{\begin{twocollist}
369 \twocolitem{{\bf Show(flag)}}{Shows or hides the entire radiobox.}
370 \twocolitem{{\bf ShowItem(n, flag)}}{Shows or hides individual buttons.}
371 \end{twocollist}}
372 }