]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/radiobox.tex
added wxRadioBox::IsItemEnabled/Shown() (for MSW only for now, other platforms to...
[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::GetCount}\label{wxradioboxgetcount}
189
190 \constfunc{int}{GetCount}{\void}
191
192 Returns the number of items in the radiobox.
193
194
195 \membersection{wxRadioBox::GetLabel}\label{wxradioboxgetlabel}
196
197 \constfunc{wxString}{GetLabel}{\void}
198
199 Returns the radiobox label.
200
201 \wxheading{Parameters}
202
203 \docparam{n}{The zero-based button index.}
204
205 \wxheading{See also}
206
207 \helpref{wxRadioBox::SetLabel}{wxradioboxsetlabel}
208
209 \pythonnote{In place of a single overloaded method name, wxPython
210 implements the following methods:\par
211 \indented{2cm}{\begin{twocollist}
212 \twocolitem{{\bf GetLabel()}}{Returns the radiobox label.}
213 \twocolitem{{\bf GetItemLabel(n)}}{Returns the label for the given button.}
214 \end{twocollist}}
215 }
216
217
218 \membersection{wxRadioBox::GetSelection}\label{wxradioboxgetselection}
219
220 \constfunc{int}{GetSelection}{\void}
221
222 Returns the zero-based position of the selected button.
223
224
225 \membersection{wxRadioBox::GetStringSelection}\label{wxradioboxgetstringselection}
226
227 \constfunc{wxString}{GetStringSelection}{\void}
228
229 Returns the selected string.
230
231
232 \membersection{wxRadioBox::GetString}\label{wxradioboxgetstring}
233
234 \constfunc{wxString}{GetString}{\param{int}{ n}}
235
236 Returns the label for the button at the given position.
237
238 \wxheading{Parameters}
239
240 \docparam{n}{The zero-based button position.}
241
242
243 \membersection{wxRadioBox::IsItemEnabled}\label{wxradioboxisitemenabled}
244
245 \constfunc{bool}{IsItemEnabled}{\void}
246
247 Returns \true if the item is enabled or \false if it was disabled using
248 \helpref{Enable(n, false)}{wxradioboxenable}.
249
250 {\bf Platform note:} Currently only implemented in wxMSW and always returns
251 \true in the other ports.
252
253
254 \membersection{wxRadioBox::IsItemShown}\label{wxradioboxisitemshown}
255
256 \constfunc{bool}{IsItemShown}{\void}
257
258 Returns \true if the item is currently shown or \false if it was hidden using
259 \helpref{Show(n, false)}{wxradioboxshow}.
260
261 Note that this function returns \true for an item which hadn't been hidden even
262 if the entire radiobox is not currently shown.
263
264 {\bf Platform note:} Currently only implemented in wxMSW and always returns
265 \true in the other ports.
266
267
268 \membersection{wxRadioBox::Number}\label{wxradioboxnumber}
269
270 \constfunc{int}{Number}{\void}
271
272 {\bf Obsolescence note:} This method is obsolete and was replaced with
273 \helpref{GetCount}{wxradioboxgetcount}, please use the new method in the new
274 code. This method is only available if wxWidgets was compiled with
275 {\tt WXWIN\_COMPATIBILITY\_2\_2} defined and will disappear completely in
276 future versions.
277
278 Returns the number of buttons in the radiobox.
279
280
281 \membersection{wxRadioBox::SetLabel}\label{wxradioboxsetlabel}
282
283 \func{void}{SetLabel}{\param{const wxString\&}{ label}}
284
285 Sets the radiobox label.
286
287
288 \wxheading{Parameters}
289
290 \docparam{label}{The label to set.}
291
292 \docparam{n}{The zero-based button index.}
293
294 \pythonnote{In place of a single overloaded method name, wxPython
295 implements the following methods:\par
296 \indented{2cm}{\begin{twocollist}
297 \twocolitem{{\bf SetLabel(string)}}{Sets the radiobox label.}
298 \twocolitem{{\bf SetItemLabel(n, string)}}{Sets a label for a radio button.}
299 \end{twocollist}}
300 }
301
302
303 \membersection{wxRadioBox::SetSelection}\label{wxradioboxsetselection}
304
305 \func{void}{SetSelection}{\param{int}{ n}}
306
307 Sets a button by passing the desired string position. This does not cause
308 a wxEVT\_COMMAND\_RADIOBOX\_SELECTED event to get emitted.
309
310 \wxheading{Parameters}
311
312 \docparam{n}{The zero-based button position.}
313
314
315 \membersection{wxRadioBox::SetStringSelection}\label{wxradioboxsetstringselection}
316
317 \func{void}{SetStringSelection}{\param{const wxString\& }{string}}
318
319 Sets the selection to a button by passing the desired string. This does not cause
320 a wxEVT\_COMMAND\_RADIOBOX\_SELECTED event to get emitted.
321
322 \wxheading{Parameters}
323
324 \docparam{string}{The label of the button to select.}
325
326
327 \membersection{wxRadioBox::Show}\label{wxradioboxshow}
328
329 \func{virtual bool}{Show}{\param{const bool}{ show = {\tt true}}}
330
331 Shows or hides the entire radiobox.
332
333 \func{virtual bool}{Show}{\param{int}{ item}, \param{const bool}{ show = {\tt true}}}
334
335 Shows or hides individual buttons.
336
337 \wxheading{Parameters}
338
339 \docparam{show}{true to show, false to hide.}
340
341 \docparam{item}{The zero-based position of the button to show or hide.}
342
343 \wxheading{Return value}
344
345 {\tt true} if the box or item has been shown or hidden or {\tt false} if nothing was
346 done because it already was in the requested state.
347
348 \wxheading{See also}
349
350 \helpref{wxWindow::Show}{wxwindowshow}
351
352 \pythonnote{In place of a single overloaded method name, wxPython
353 implements the following methods:\par
354 \indented{2cm}{\begin{twocollist}
355 \twocolitem{{\bf Show(flag)}}{Shows or hides the entire radiobox.}
356 \twocolitem{{\bf ShowItem(n, flag)}}{Shows or hides individual buttons.}
357 \end{twocollist}}
358 }