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