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