]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/radiobox.tex
another patch bring the docs more up to date (patch 1717776)
[wxWidgets.git] / docs / latex / wx / radiobox.tex
CommitLineData
03021f71
WS
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: radiobox.tex
3%% Purpose: wxRadioBox documentation
4%% Author: wxWidgets Team
5%% Modified by:
afbe150a 6%% Created:
03021f71
WS
7%% RCS-ID: $Id$
8%% Copyright: (c) wxWidgets Team
8795498c 9%% License: wxWindows license
03021f71
WS
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
a660d684
KB
12\section{\class{wxRadioBox}}\label{wxradiobox}
13
14A radio box item is used to select one of number of mutually exclusive
15choices. It is displayed as a vertical column or horizontal row of
16labelled buttons.
17
18\wxheading{Derived from}
19
afbe150a 20\helpref{wxControlWithItems}{wxcontrolwithitems}\\
a660d684
KB
21\helpref{wxControl}{wxcontrol}\\
22\helpref{wxWindow}{wxwindow}\\
23\helpref{wxEvtHandler}{wxevthandler}\\
24\helpref{wxObject}{wxobject}
25
954b8ae6
JS
26\wxheading{Include files}
27
28<wx/radiobox.h>
29
a660d684
KB
30\wxheading{Window styles}
31
32\twocolwidtha{5cm}
33\begin{twocollist}\itemsep=0pt
94b49b93
JS
34\twocolitem{\windowstyle{wxRA\_SPECIFY\_ROWS}}{The major dimension parameter refers to the
35maximum number of rows.}
36\twocolitem{\windowstyle{wxRA\_SPECIFY\_COLS}}{The major dimension parameter refers to the
37maximum number of columns.}
bcf576cc
WS
38\twocolitem{\windowstyle{wxRA\_USE\_CHECKBOX}}{Use of the checkbox controls instead of radio
39buttons (currently supported only on PalmOS)}
a660d684
KB
40\end{twocollist}
41
42See also \helpref{window styles overview}{windowstyles}.
43
5de76427
JS
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,
49when a radiobutton is clicked.}
50\end{twocollist}
51
a660d684
KB
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
3bfa7be9 59
3e79fa75 60\membersection{wxRadioBox::wxRadioBox}\label{wxradioboxctor}
a660d684
KB
61
62\func{}{wxRadioBox}{\void}
63
64Default constructor.
65
eaaa6a06 66\func{}{wxRadioBox}{\param{wxWindow* }{parent}, \param{wxWindowID }{id}, \param{const wxString\& }{label},\rtfsp
a660d684 67\param{const wxPoint\& }{point = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
eaaa6a06 68\param{int}{ n = 0}, \param{const wxString}{ choices[] = NULL},\rtfsp
94b49b93 69\param{int}{ majorDimension = 0}, \param{long}{ style = wxRA\_SPECIFY\_COLS},\rtfsp
a660d684
KB
70\param{const wxValidator\& }{validator = wxDefaultValidator},\rtfsp
71\param{const wxString\& }{name = ``radioBox"}}
72
56b88f12
MB
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
a660d684
KB
80Constructor, 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
94b49b93 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
a660d684
KB
99radiobox.}
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
c9110876
VS
111\pythonnote{The wxRadioBox constructor in wxPython reduces the {\tt n}
112and {\tt choices} arguments are to a single argument, which is
06d20283
RD
113a list of strings.}
114
5873607e
VZ
115\perlnote{In wxPerl there is just an array reference in place of {\tt n}
116and {\tt choices}.}
06d20283 117
3bfa7be9 118
3e79fa75 119\membersection{wxRadioBox::\destruct{wxRadioBox}}\label{wxradioboxdtor}
a660d684
KB
120
121\func{}{\destruct{wxRadioBox}}{\void}
122
123Destructor, destroying the radiobox item.
124
3bfa7be9 125
a660d684
KB
126\membersection{wxRadioBox::Create}\label{wxradioboxcreate}
127
eaaa6a06 128\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID }{id}, \param{const wxString\& }{label},\rtfsp
a660d684 129\param{const wxPoint\& }{point = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
eaaa6a06 130\param{int}{ n = 0}, \param{const wxString}{ choices[] = NULL},\rtfsp
94b49b93 131\param{int}{ majorDimension = 0}, \param{long}{ style = wxRA\_SPECIFY\_COLS},\rtfsp
a660d684 132\param{const wxValidator\& }{validator = wxDefaultValidator},\rtfsp
56b88f12
MB
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
a660d684
KB
140\param{const wxString\& }{name = ``radioBox"}}
141
3e79fa75 142Creates the radiobox for two-step construction. See \helpref{wxRadioBox::wxRadioBox}{wxradioboxctor}\rtfsp
a660d684
KB
143for further details.
144
3bfa7be9 145
a660d684
KB
146\membersection{wxRadioBox::Enable}\label{wxradioboxenable}
147
1a87edf2 148\func{virtual bool}{Enable}{\param{bool}{ enable = {\tt true}}}
a660d684
KB
149
150Enables or disables the entire radiobox.
151
aa61d352 152\func{virtual bool}{Enable}{\param{unsigned int}{ n}, \param{bool}{ enable = {\tt true}}}
a660d684
KB
153
154Enables or disables an individual button in the radiobox.
155
156\wxheading{Parameters}
157
cc81d32f 158\docparam{enable}{true to enable, false to disable.}
a660d684
KB
159
160\docparam{n}{The zero-based button to enable or disable.}
161
21f280f4
RD
162\pythonnote{In place of a single overloaded method name, wxPython
163implements the following methods:\par
164\indented{2cm}{\begin{twocollist}
c9110876
VS
165\twocolitem{{\bf Enable(flag)}}{Enables or disables the entire radiobox.}
166\twocolitem{{\bf EnableItem(n, flag)}}{Enables or disables an
21f280f4
RD
167individual button in the radiobox.}
168\end{twocollist}}
169}
170
1a87edf2
WS
171\wxheading{See also}
172
173\helpref{wxWindow::Enable}{wxwindowenable}
174
21f280f4 175
3bfa7be9 176
a660d684
KB
177\membersection{wxRadioBox::FindString}\label{wxradioboxfindstring}
178
179\constfunc{int}{FindString}{\param{const wxString\& }{string}}
180
181Finds 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
3bfa7be9 188
21e0a4d5
VZ
189\membersection{wxRadioBox::GetColumnCount}\label{wxradioboxgetcolumncount}
190
aa61d352 191\constfunc{unsigned int}{GetColumnCount}{\void}
21e0a4d5
VZ
192
193Returns the number of columns in the radiobox.
194
195
36a50ffe
VZ
196\membersection{wxRadioBox::GetItemHelpText}\label{wxradioboxgetitemhelptext}
197
198\constfunc{wxString}{GetItemHelpText}{\param{unsigned int}{ item}}
199
200Returns the helptext associated with the specified \arg{item} if any or {\tt wxEmptyString}.
201
202\wxheading{Parameters}
203
204\docparam{item}{The zero-based item index.}
205
206\wxheading{See also}
207
208\helpref{SetItemHelpText}{wxradioboxsetitemhelptext}
209
210
c670c855
VZ
211\membersection{wxRadioBox::GetItemToolTip}\label{wxradioboxgetitemtooltip}
212
213\constfunc{wxToolTip *}{GetItemToolTip}{\param{unsigned int}{ item}}
214
215Returns the tooltip associated with the specified \arg{item} if any or \NULL.
216
217\wxheading{See also}
218
219\helpref{SetItemToolTip}{wxradioboxsetitemtooltip},\\
220\helpref{wxWindow::GetToolTip}{wxwindowgettooltip}
221
222
36a50ffe
VZ
223\membersection{wxRadioBox::GetItemFromPoint}\label{wxradioboxgetitemfrompoint}
224
225\constfunc{int}{GetItemFromPoint}{\param{const wxPoint&}{ pt}}
226
227Returns a radio box item under the point, a zero-based item index, or {\tt wxNOT\_FOUND} if no item is under the point.
228
229\docparam{pt}{Point in client coordinates.}
230
231
a660d684
KB
232\membersection{wxRadioBox::GetLabel}\label{wxradioboxgetlabel}
233
234\constfunc{wxString}{GetLabel}{\void}
235
236Returns the radiobox label.
237
a660d684
KB
238\wxheading{Parameters}
239
240\docparam{n}{The zero-based button index.}
241
242\wxheading{See also}
243
244\helpref{wxRadioBox::SetLabel}{wxradioboxsetlabel}
245
21f280f4
RD
246\pythonnote{In place of a single overloaded method name, wxPython
247implements the following methods:\par
248\indented{2cm}{\begin{twocollist}
c9110876
VS
249\twocolitem{{\bf GetLabel()}}{Returns the radiobox label.}
250\twocolitem{{\bf GetItemLabel(n)}}{Returns the label for the given button.}
21f280f4
RD
251\end{twocollist}}
252}
253
254
21e0a4d5
VZ
255\membersection{wxRadioBox::GetRowCount}\label{wxradioboxgetrowcount}
256
aa61d352 257\constfunc{unsigned int}{GetRowCount}{\void}
21e0a4d5
VZ
258
259Returns the number of rows in the radiobox.
260
261
a660d684
KB
262\membersection{wxRadioBox::GetSelection}\label{wxradioboxgetselection}
263
264\constfunc{int}{GetSelection}{\void}
265
266Returns the zero-based position of the selected button.
267
3bfa7be9 268
a660d684
KB
269\membersection{wxRadioBox::GetStringSelection}\label{wxradioboxgetstringselection}
270
271\constfunc{wxString}{GetStringSelection}{\void}
272
273Returns the selected string.
274
3bfa7be9 275
d61c1a6f
JS
276\membersection{wxRadioBox::GetString}\label{wxradioboxgetstring}
277
aa61d352 278\constfunc{wxString}{GetString}{\param{unsigned int}{ n}}
d61c1a6f
JS
279
280Returns the label for the button at the given position.
281
282\wxheading{Parameters}
283
284\docparam{n}{The zero-based button position.}
285
3bfa7be9
VZ
286
287\membersection{wxRadioBox::IsItemEnabled}\label{wxradioboxisitemenabled}
288
aa61d352 289\constfunc{bool}{IsItemEnabled}{\param{unsigned int}{ n}}
3bfa7be9 290
afbe150a 291Returns \true if the item is enabled or \false if it was disabled using
3bfa7be9
VZ
292\helpref{Enable(n, false)}{wxradioboxenable}.
293
066a3578
VZ
294{\bf Platform note:} Currently only implemented in wxMSW, wxGTK and wxUniversal
295and always returns \true in the other ports.
3bfa7be9 296
aa61d352
VZ
297\wxheading{Parameters}
298
299\docparam{n}{The zero-based button position.}
300
3bfa7be9
VZ
301
302\membersection{wxRadioBox::IsItemShown}\label{wxradioboxisitemshown}
303
aa61d352 304\constfunc{bool}{IsItemShown}{\param{unsigned int}{ n}}
3bfa7be9 305
afbe150a 306Returns \true if the item is currently shown or \false if it was hidden using
3bfa7be9
VZ
307\helpref{Show(n, false)}{wxradioboxshow}.
308
309Note that this function returns \true for an item which hadn't been hidden even
310if the entire radiobox is not currently shown.
311
066a3578
VZ
312{\bf Platform note:} Currently only implemented in wxMSW, wxGTK and wxUniversal
313and always returns \true in the other ports.
3bfa7be9 314
aa61d352
VZ
315\wxheading{Parameters}
316
317\docparam{n}{The zero-based button position.}
318
3bfa7be9 319
36a50ffe
VZ
320\membersection{wxRadioBox::SetItemHelpText}\label{wxradioboxsetitemhelptext}
321
322\func{void}{SetItemHelpText}{\param{unsigned int}{ item}, \param{const wxString\&}{ helptext}}
323
324Sets the helptext for an item. Empty string erases any existing helptext.
325
326\wxheading{Parameters}
327
328\docparam{item}{The zero-based item index.}
329
330\docparam{helptext}{The help text to set for the item.}
331
332\wxheading{See also}
333
334\helpref{GetItemHelpText}{wxradioboxgetitemhelptext}
335
336
a660d684
KB
337\membersection{wxRadioBox::SetLabel}\label{wxradioboxsetlabel}
338
339\func{void}{SetLabel}{\param{const wxString\&}{ label}}
340
341Sets the radiobox label.
342
a660d684
KB
343
344\wxheading{Parameters}
345
346\docparam{label}{The label to set.}
347
348\docparam{n}{The zero-based button index.}
349
21f280f4
RD
350\pythonnote{In place of a single overloaded method name, wxPython
351implements the following methods:\par
352\indented{2cm}{\begin{twocollist}
c9110876
VS
353\twocolitem{{\bf SetLabel(string)}}{Sets the radiobox label.}
354\twocolitem{{\bf SetItemLabel(n, string)}}{Sets a label for a radio button.}
21f280f4
RD
355\end{twocollist}}
356}
357
3bfa7be9 358
a660d684
KB
359\membersection{wxRadioBox::SetSelection}\label{wxradioboxsetselection}
360
eaaa6a06 361\func{void}{SetSelection}{\param{int}{ n}}
a660d684 362
953704c1
RR
363Sets a button by passing the desired string position. This does not cause
364a wxEVT\_COMMAND\_RADIOBOX\_SELECTED event to get emitted.
a660d684
KB
365
366\wxheading{Parameters}
367
368\docparam{n}{The zero-based button position.}
369
3bfa7be9 370
a660d684
KB
371\membersection{wxRadioBox::SetStringSelection}\label{wxradioboxsetstringselection}
372
373\func{void}{SetStringSelection}{\param{const wxString\& }{string}}
374
953704c1
RR
375Sets the selection to a button by passing the desired string. This does not cause
376a wxEVT\_COMMAND\_RADIOBOX\_SELECTED event to get emitted.
a660d684
KB
377
378\wxheading{Parameters}
379
380\docparam{string}{The label of the button to select.}
381
3bfa7be9 382
c670c855
VZ
383\membersection{wxRadioBox::SetItemToolTip}\label{wxradioboxsetitemtooltip}
384
385\func{void}{SetItemToolTip}{\param{unsigned int}{ item}, \param{const wxString\& }{text}}
386
387Sets the tooltip text for the specified item in the radio group.
388
4dfda526
VZ
389{\bf Platform note:} Currently only implemented in wxMSW and wxGTK2 and does
390nothing in the other ports.
391
c670c855
VZ
392\wxheading{Parameters}
393
394\docparam{item}{Index of the item the tooltip will be shown for.}
395
396\docparam{text}{Tooltip text for the item, the tooltip is removed if empty.}
397
398\wxheading{See also}
399
400\helpref{GetItemToolTip}{wxradioboxgetitemtooltip},\\
401\helpref{wxWindow::SetToolTip}{wxwindowsettooltip}
402
403
a660d684
KB
404\membersection{wxRadioBox::Show}\label{wxradioboxshow}
405
03021f71 406\func{virtual bool}{Show}{\param{const bool}{ show = {\tt true}}}
a660d684
KB
407
408Shows or hides the entire radiobox.
409
aa61d352 410\func{virtual bool}{Show}{\param{unsigned int}{ item}, \param{const bool}{ show = {\tt true}}}
a660d684
KB
411
412Shows or hides individual buttons.
413
414\wxheading{Parameters}
415
cc81d32f 416\docparam{show}{true to show, false to hide.}
a660d684
KB
417
418\docparam{item}{The zero-based position of the button to show or hide.}
419
03021f71
WS
420\wxheading{Return value}
421
422{\tt true} if the box or item has been shown or hidden or {\tt false} if nothing was
423done because it already was in the requested state.
424
425\wxheading{See also}
426
427\helpref{wxWindow::Show}{wxwindowshow}
428
21f280f4
RD
429\pythonnote{In place of a single overloaded method name, wxPython
430implements the following methods:\par
431\indented{2cm}{\begin{twocollist}
c9110876
VS
432\twocolitem{{\bf Show(flag)}}{Shows or hides the entire radiobox.}
433\twocolitem{{\bf ShowItem(n, flag)}}{Shows or hides individual buttons.}
21f280f4
RD
434\end{twocollist}}
435}