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