]>
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 | ||
58 | Constructor, creating and showing a radiobox. | |
59 | ||
60 | \wxheading{Parameters} | |
61 | ||
62 | \docparam{parent}{Parent window. Must not be NULL.} | |
63 | ||
64 | \docparam{id}{Window identifier. A value of -1 indicates a default value.} | |
65 | ||
66 | \docparam{label}{Label for the static box surrounding the radio buttons.} | |
67 | ||
68 | \docparam{pos}{Window position. If the position (-1, -1) is specified then a default position is chosen.} | |
69 | ||
70 | \docparam{size}{Window size. If the default size (-1, -1) is specified then a default size is chosen.} | |
71 | ||
72 | \docparam{n}{Number of choices with which to initialize the radiobox.} | |
73 | ||
74 | \docparam{choices}{An array of choices with which to initialize the radiobox.} | |
75 | ||
94b49b93 | 76 | \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 |
77 | radiobox.} |
78 | ||
79 | \docparam{style}{Window style. See \helpref{wxRadioBox}{wxradiobox}.} | |
80 | ||
81 | \docparam{validator}{Window validator.} | |
82 | ||
83 | \docparam{name}{Window name.} | |
84 | ||
85 | \wxheading{See also} | |
86 | ||
87 | \helpref{wxRadioBox::Create}{wxradioboxcreate}, \helpref{wxValidator}{wxvalidator} | |
88 | ||
c9110876 VS |
89 | \pythonnote{The wxRadioBox constructor in wxPython reduces the {\tt n} |
90 | and {\tt choices} arguments are to a single argument, which is | |
06d20283 RD |
91 | a list of strings.} |
92 | ||
5873607e VZ |
93 | \perlnote{In wxPerl there is just an array reference in place of {\tt n} |
94 | and {\tt choices}.} | |
06d20283 | 95 | |
a660d684 KB |
96 | \membersection{wxRadioBox::\destruct{wxRadioBox}} |
97 | ||
98 | \func{}{\destruct{wxRadioBox}}{\void} | |
99 | ||
100 | Destructor, destroying the radiobox item. | |
101 | ||
102 | \membersection{wxRadioBox::Create}\label{wxradioboxcreate} | |
103 | ||
eaaa6a06 | 104 | \func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID }{id}, \param{const wxString\& }{label},\rtfsp |
a660d684 | 105 | \param{const wxPoint\& }{point = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp |
eaaa6a06 | 106 | \param{int}{ n = 0}, \param{const wxString}{ choices[] = NULL},\rtfsp |
94b49b93 | 107 | \param{int}{ majorDimension = 0}, \param{long}{ style = wxRA\_SPECIFY\_COLS},\rtfsp |
a660d684 KB |
108 | \param{const wxValidator\& }{validator = wxDefaultValidator},\rtfsp |
109 | \param{const wxString\& }{name = ``radioBox"}} | |
110 | ||
111 | Creates the radiobox for two-step construction. See \helpref{wxRadioBox::wxRadioBox}{wxradioboxconstr}\rtfsp | |
112 | for further details. | |
113 | ||
114 | \membersection{wxRadioBox::Enable}\label{wxradioboxenable} | |
115 | ||
cc81d32f | 116 | \func{void}{Enable}{\param{bool}{ enable = {\tt true}}} |
a660d684 KB |
117 | |
118 | Enables or disables the entire radiobox. | |
119 | ||
cc81d32f | 120 | \func{void}{Enable}{\param{int}{ n}, \param{bool}{ enable = {\tt true}}} |
a660d684 KB |
121 | |
122 | Enables or disables an individual button in the radiobox. | |
123 | ||
124 | \wxheading{Parameters} | |
125 | ||
cc81d32f | 126 | \docparam{enable}{true to enable, false to disable.} |
a660d684 KB |
127 | |
128 | \docparam{n}{The zero-based button to enable or disable.} | |
129 | ||
21f280f4 RD |
130 | \pythonnote{In place of a single overloaded method name, wxPython |
131 | implements the following methods:\par | |
132 | \indented{2cm}{\begin{twocollist} | |
c9110876 VS |
133 | \twocolitem{{\bf Enable(flag)}}{Enables or disables the entire radiobox.} |
134 | \twocolitem{{\bf EnableItem(n, flag)}}{Enables or disables an | |
21f280f4 RD |
135 | individual button in the radiobox.} |
136 | \end{twocollist}} | |
137 | } | |
138 | ||
139 | ||
a660d684 KB |
140 | \membersection{wxRadioBox::FindString}\label{wxradioboxfindstring} |
141 | ||
142 | \constfunc{int}{FindString}{\param{const wxString\& }{string}} | |
143 | ||
144 | Finds a button matching the given string, returning the position if found, or | |
145 | -1 if not found. | |
146 | ||
147 | \wxheading{Parameters} | |
148 | ||
149 | \docparam{string}{The string to find.} | |
150 | ||
28ca7610 VZ |
151 | \membersection{wxRadioBox::GetCount}\label{wxradioboxgetcount} |
152 | ||
153 | \constfunc{int}{GetCount}{\void} | |
154 | ||
155 | Returns the number of items in the radiobox. | |
156 | ||
a660d684 KB |
157 | \membersection{wxRadioBox::GetLabel}\label{wxradioboxgetlabel} |
158 | ||
159 | \constfunc{wxString}{GetLabel}{\void} | |
160 | ||
161 | Returns the radiobox label. | |
162 | ||
eaaa6a06 | 163 | \constfunc{wxString}{GetLabel}{\param{int }{n}} |
a660d684 KB |
164 | |
165 | Returns the label for the given button. | |
166 | ||
167 | \wxheading{Parameters} | |
168 | ||
169 | \docparam{n}{The zero-based button index.} | |
170 | ||
171 | \wxheading{See also} | |
172 | ||
173 | \helpref{wxRadioBox::SetLabel}{wxradioboxsetlabel} | |
174 | ||
21f280f4 RD |
175 | \pythonnote{In place of a single overloaded method name, wxPython |
176 | implements the following methods:\par | |
177 | \indented{2cm}{\begin{twocollist} | |
c9110876 VS |
178 | \twocolitem{{\bf GetLabel()}}{Returns the radiobox label.} |
179 | \twocolitem{{\bf GetItemLabel(n)}}{Returns the label for the given button.} | |
21f280f4 RD |
180 | \end{twocollist}} |
181 | } | |
182 | ||
183 | ||
a660d684 KB |
184 | \membersection{wxRadioBox::GetSelection}\label{wxradioboxgetselection} |
185 | ||
186 | \constfunc{int}{GetSelection}{\void} | |
187 | ||
188 | Returns the zero-based position of the selected button. | |
189 | ||
190 | \membersection{wxRadioBox::GetStringSelection}\label{wxradioboxgetstringselection} | |
191 | ||
192 | \constfunc{wxString}{GetStringSelection}{\void} | |
193 | ||
194 | Returns the selected string. | |
195 | ||
196 | \membersection{wxRadioBox::Number}\label{wxradioboxnumber} | |
197 | ||
198 | \constfunc{int}{Number}{\void} | |
199 | ||
28ca7610 | 200 | {\bf Obsolescence note:} This method is obsolete and was replaced with |
e676441f | 201 | \helpref{GetCount}{wxradioboxgetcount}, please use the new method in the new |
28ca7610 VZ |
202 | code. This method is only available if wxWindows was compiled with |
203 | {\tt WXWIN\_COMPATIBILITY\_2\_2} defined and will disappear completely in | |
204 | future versions. | |
205 | ||
a660d684 KB |
206 | Returns the number of buttons in the radiobox. |
207 | ||
208 | \membersection{wxRadioBox::SetLabel}\label{wxradioboxsetlabel} | |
209 | ||
210 | \func{void}{SetLabel}{\param{const wxString\&}{ label}} | |
211 | ||
212 | Sets the radiobox label. | |
213 | ||
eaaa6a06 | 214 | \func{void}{SetLabel}{\param{int }{n}, \param{const wxString\&}{ label}} |
a660d684 KB |
215 | |
216 | Sets a label for a radio button. | |
217 | ||
218 | \wxheading{Parameters} | |
219 | ||
220 | \docparam{label}{The label to set.} | |
221 | ||
222 | \docparam{n}{The zero-based button index.} | |
223 | ||
21f280f4 RD |
224 | \pythonnote{In place of a single overloaded method name, wxPython |
225 | implements the following methods:\par | |
226 | \indented{2cm}{\begin{twocollist} | |
c9110876 VS |
227 | \twocolitem{{\bf SetLabel(string)}}{Sets the radiobox label.} |
228 | \twocolitem{{\bf SetItemLabel(n, string)}}{Sets a label for a radio button.} | |
21f280f4 RD |
229 | \end{twocollist}} |
230 | } | |
231 | ||
a660d684 KB |
232 | \membersection{wxRadioBox::SetSelection}\label{wxradioboxsetselection} |
233 | ||
eaaa6a06 | 234 | \func{void}{SetSelection}{\param{int}{ n}} |
a660d684 | 235 | |
953704c1 RR |
236 | Sets a button by passing the desired string position. This does not cause |
237 | a wxEVT\_COMMAND\_RADIOBOX\_SELECTED event to get emitted. | |
a660d684 KB |
238 | |
239 | \wxheading{Parameters} | |
240 | ||
241 | \docparam{n}{The zero-based button position.} | |
242 | ||
243 | \membersection{wxRadioBox::SetStringSelection}\label{wxradioboxsetstringselection} | |
244 | ||
245 | \func{void}{SetStringSelection}{\param{const wxString\& }{string}} | |
246 | ||
953704c1 RR |
247 | Sets the selection to a button by passing the desired string. This does not cause |
248 | a wxEVT\_COMMAND\_RADIOBOX\_SELECTED event to get emitted. | |
a660d684 KB |
249 | |
250 | \wxheading{Parameters} | |
251 | ||
252 | \docparam{string}{The label of the button to select.} | |
253 | ||
254 | \membersection{wxRadioBox::Show}\label{wxradioboxshow} | |
255 | ||
256 | \func{void}{Show}{\param{const bool}{ show}} | |
257 | ||
258 | Shows or hides the entire radiobox. | |
259 | ||
eaaa6a06 | 260 | \func{void}{Show}{\param{int }{item}, \param{const bool}{ show}} |
a660d684 KB |
261 | |
262 | Shows or hides individual buttons. | |
263 | ||
264 | \wxheading{Parameters} | |
265 | ||
cc81d32f | 266 | \docparam{show}{true to show, false to hide.} |
a660d684 KB |
267 | |
268 | \docparam{item}{The zero-based position of the button to show or hide.} | |
269 | ||
21f280f4 RD |
270 | \pythonnote{In place of a single overloaded method name, wxPython |
271 | implements the following methods:\par | |
272 | \indented{2cm}{\begin{twocollist} | |
c9110876 VS |
273 | \twocolitem{{\bf Show(flag)}}{Shows or hides the entire radiobox.} |
274 | \twocolitem{{\bf ShowItem(n, flag)}}{Shows or hides individual buttons.} | |
21f280f4 RD |
275 | \end{twocollist}} |
276 | } | |
277 | ||
a660d684 KB |
278 | \membersection{wxRadioBox::GetString}\label{wxradioboxgetstring} |
279 | ||
eaaa6a06 | 280 | \constfunc{wxString}{GetString}{\param{int}{ n}} |
a660d684 KB |
281 | |
282 | Returns the label for the button at the given position. | |
283 | ||
284 | \wxheading{Parameters} | |
285 | ||
286 | \docparam{n}{The zero-based button position.} | |
287 | ||
288 |