1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %% Purpose: wxRadioBox documentation
4 %% Author: wxWidgets Team
8 %% Copyright: (c) wxWidgets Team
9 %% License: wxWindows license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 \section{\class{wxRadioBox
}}\label{wxradiobox
}
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
18 \wxheading{Derived from
}
20 \helpref{wxControl
}{wxcontrol
}\\
21 \helpref{wxWindow
}{wxwindow
}\\
22 \helpref{wxEvtHandler
}{wxevthandler
}\\
23 \helpref{wxObject
}{wxobject
}
25 \wxheading{Include files
}
29 \wxheading{Window styles
}
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)
}
41 See also
\helpref{window styles overview
}{windowstyles
}.
43 \wxheading{Event handling
}
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.
}
53 \helpref{Event handling overview
}{eventhandlingoverview
},
\helpref{wxRadioButton
}{wxradiobutton
},
\rtfsp
54 \helpref{wxCheckBox
}{wxcheckbox
}
56 \latexignore{\rtfignore{\wxheading{Members
}}}
59 \membersection{wxRadioBox::wxRadioBox
}\label{wxradioboxctor
}
61 \func{}{wxRadioBox
}{\void}
65 \func{}{wxRadioBox
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{id
},
\param{const wxString\&
}{label
},
\rtfsp
66 \param{const wxPoint\&
}{point = wxDefaultPosition
},
\param{const wxSize\&
}{size = wxDefaultSize
},
\rtfsp
67 \param{int
}{ n =
0},
\param{const wxString
}{ choices
[] = NULL
},
\rtfsp
68 \param{int
}{ majorDimension =
0},
\param{long
}{ style = wxRA
\_SPECIFY\_COLS},
\rtfsp
69 \param{const wxValidator\&
}{validator = wxDefaultValidator
},
\rtfsp
70 \param{const wxString\&
}{name = ``radioBox"
}}
72 \func{}{wxRadioBox
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{id
},
\param{const wxString\&
}{label
},
\rtfsp
73 \param{const wxPoint\&
}{point
},
\param{const wxSize\&
}{size
},
\rtfsp
74 \param{const wxArrayString\&
}{ choices
},
\rtfsp
75 \param{int
}{ majorDimension =
0},
\param{long
}{ style = wxRA
\_SPECIFY\_COLS},
\rtfsp
76 \param{const wxValidator\&
}{validator = wxDefaultValidator
},
\rtfsp
77 \param{const wxString\&
}{name = ``radioBox"
}}
79 Constructor, creating and showing a radiobox.
81 \wxheading{Parameters
}
83 \docparam{parent
}{Parent window. Must not be NULL.
}
85 \docparam{id
}{Window identifier. A value of -
1 indicates a default value.
}
87 \docparam{label
}{Label for the static box surrounding the radio buttons.
}
89 \docparam{pos
}{Window position. If the position (-
1, -
1) is specified then a default position is chosen.
}
91 \docparam{size
}{Window size. If the default size (-
1, -
1) is specified then a default size is chosen.
}
93 \docparam{n
}{Number of choices with which to initialize the radiobox.
}
95 \docparam{choices
}{An array of choices with which to initialize the radiobox.
}
97 \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
100 \docparam{style
}{Window style. See
\helpref{wxRadioBox
}{wxradiobox
}.
}
102 \docparam{validator
}{Window validator.
}
104 \docparam{name
}{Window name.
}
108 \helpref{wxRadioBox::Create
}{wxradioboxcreate
},
\helpref{wxValidator
}{wxvalidator
}
110 \pythonnote{The wxRadioBox constructor in wxPython reduces the
{\tt n
}
111 and
{\tt choices
} arguments are to a single argument, which is
114 \perlnote{In wxPerl there is just an array reference in place of
{\tt n
}
118 \membersection{wxRadioBox::
\destruct{wxRadioBox
}}\label{wxradioboxdtor
}
120 \func{}{\destruct{wxRadioBox
}}{\void}
122 Destructor, destroying the radiobox item.
125 \membersection{wxRadioBox::Create
}\label{wxradioboxcreate
}
127 \func{bool
}{Create
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{id
},
\param{const wxString\&
}{label
},
\rtfsp
128 \param{const wxPoint\&
}{point = wxDefaultPosition
},
\param{const wxSize\&
}{size = wxDefaultSize
},
\rtfsp
129 \param{int
}{ n =
0},
\param{const wxString
}{ choices
[] = NULL
},
\rtfsp
130 \param{int
}{ majorDimension =
0},
\param{long
}{ style = wxRA
\_SPECIFY\_COLS},
\rtfsp
131 \param{const wxValidator\&
}{validator = wxDefaultValidator
},
\rtfsp
132 \param{const wxString\&
}{name = ``radioBox"
}}
134 \func{bool
}{Create
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{id
},
\param{const wxString\&
}{label
},
\rtfsp
135 \param{const wxPoint\&
}{point
},
\param{const wxSize\&
}{size
},
\rtfsp
136 \param{const wxArrayString\&
}{ choices
},
\rtfsp
137 \param{int
}{ majorDimension =
0},
\param{long
}{ style = wxRA
\_SPECIFY\_COLS},
\rtfsp
138 \param{const wxValidator\&
}{validator = wxDefaultValidator
},
\rtfsp
139 \param{const wxString\&
}{name = ``radioBox"
}}
141 Creates the radiobox for two-step construction. See
\helpref{wxRadioBox::wxRadioBox
}{wxradioboxctor
}\rtfsp
145 \membersection{wxRadioBox::Enable
}\label{wxradioboxenable
}
147 \func{virtual bool
}{Enable
}{\param{bool
}{ enable =
{\tt true
}}}
149 Enables or disables the entire radiobox.
151 \func{virtual bool
}{Enable
}{\param{int
}{ n
},
\param{bool
}{ enable =
{\tt true
}}}
153 Enables or disables an individual button in the radiobox.
155 \wxheading{Parameters
}
157 \docparam{enable
}{true to enable, false to disable.
}
159 \docparam{n
}{The zero-based button to enable or disable.
}
161 \pythonnote{In place of a single overloaded method name, wxPython
162 implements the following methods:
\par
163 \indented{2cm
}{\begin{twocollist
}
164 \twocolitem{{\bf Enable(flag)
}}{Enables or disables the entire radiobox.
}
165 \twocolitem{{\bf EnableItem(n, flag)
}}{Enables or disables an
166 individual button in the radiobox.
}
172 \helpref{wxWindow::Enable
}{wxwindowenable
}
176 \membersection{wxRadioBox::FindString
}\label{wxradioboxfindstring
}
178 \constfunc{int
}{FindString
}{\param{const wxString\&
}{string
}}
180 Finds a button matching the given string, returning the position if found, or
183 \wxheading{Parameters
}
185 \docparam{string
}{The string to find.
}
188 \membersection{wxRadioBox::GetColumnCount
}\label{wxradioboxgetcolumncount
}
190 \constfunc{int
}{GetColumnCount
}{\void}
192 Returns the number of columns in the radiobox.
195 \membersection{wxRadioBox::GetCount
}\label{wxradioboxgetcount
}
197 \constfunc{int
}{GetCount
}{\void}
199 Returns the number of items in the radiobox.
202 \membersection{wxRadioBox::GetLabel
}\label{wxradioboxgetlabel
}
204 \constfunc{wxString
}{GetLabel
}{\void}
206 Returns the radiobox label.
208 \wxheading{Parameters
}
210 \docparam{n
}{The zero-based button index.
}
214 \helpref{wxRadioBox::SetLabel
}{wxradioboxsetlabel
}
216 \pythonnote{In place of a single overloaded method name, wxPython
217 implements the following methods:
\par
218 \indented{2cm
}{\begin{twocollist
}
219 \twocolitem{{\bf GetLabel()
}}{Returns the radiobox label.
}
220 \twocolitem{{\bf GetItemLabel(n)
}}{Returns the label for the given button.
}
225 \membersection{wxRadioBox::GetRowCount
}\label{wxradioboxgetrowcount
}
227 \constfunc{int
}{GetRowCount
}{\void}
229 Returns the number of rows in the radiobox.
232 \membersection{wxRadioBox::GetSelection
}\label{wxradioboxgetselection
}
234 \constfunc{int
}{GetSelection
}{\void}
236 Returns the zero-based position of the selected button.
239 \membersection{wxRadioBox::GetStringSelection
}\label{wxradioboxgetstringselection
}
241 \constfunc{wxString
}{GetStringSelection
}{\void}
243 Returns the selected string.
246 \membersection{wxRadioBox::GetString
}\label{wxradioboxgetstring
}
248 \constfunc{wxString
}{GetString
}{\param{int
}{ n
}}
250 Returns the label for the button at the given position.
252 \wxheading{Parameters
}
254 \docparam{n
}{The zero-based button position.
}
257 \membersection{wxRadioBox::IsItemEnabled
}\label{wxradioboxisitemenabled
}
259 \constfunc{bool
}{IsItemEnabled
}{\void}
261 Returns
\true if the item is enabled or
\false if it was disabled using
262 \helpref{Enable(n, false)
}{wxradioboxenable
}.
264 {\bf Platform note:
} Currently only implemented in wxMSW, wxGTK and wxUniversal
265 and always returns
\true in the other ports.
268 \membersection{wxRadioBox::IsItemShown
}\label{wxradioboxisitemshown
}
270 \constfunc{bool
}{IsItemShown
}{\void}
272 Returns
\true if the item is currently shown or
\false if it was hidden using
273 \helpref{Show(n, false)
}{wxradioboxshow
}.
275 Note that this function returns
\true for an item which hadn't been hidden even
276 if the entire radiobox is not currently shown.
278 {\bf Platform note:
} Currently only implemented in wxMSW, wxGTK and wxUniversal
279 and always returns
\true in the other ports.
282 \membersection{wxRadioBox::Number
}\label{wxradioboxnumber
}
284 \constfunc{int
}{Number
}{\void}
286 {\bf Obsolescence note:
} This method is obsolete and was replaced with
287 \helpref{GetCount
}{wxradioboxgetcount
}, please use the new method in the new
288 code. This method is only available if wxWidgets was compiled with
289 {\tt WXWIN
\_COMPATIBILITY\_2\_2} defined and will disappear completely in
292 Returns the number of buttons in the radiobox.
295 \membersection{wxRadioBox::SetLabel
}\label{wxradioboxsetlabel
}
297 \func{void
}{SetLabel
}{\param{const wxString\&
}{ label
}}
299 Sets the radiobox label.
302 \wxheading{Parameters
}
304 \docparam{label
}{The label to set.
}
306 \docparam{n
}{The zero-based button index.
}
308 \pythonnote{In place of a single overloaded method name, wxPython
309 implements the following methods:
\par
310 \indented{2cm
}{\begin{twocollist
}
311 \twocolitem{{\bf SetLabel(string)
}}{Sets the radiobox label.
}
312 \twocolitem{{\bf SetItemLabel(n, string)
}}{Sets a label for a radio button.
}
317 \membersection{wxRadioBox::SetSelection
}\label{wxradioboxsetselection
}
319 \func{void
}{SetSelection
}{\param{int
}{ n
}}
321 Sets a button by passing the desired string position. This does not cause
322 a wxEVT
\_COMMAND\_RADIOBOX\_SELECTED event to get emitted.
324 \wxheading{Parameters
}
326 \docparam{n
}{The zero-based button position.
}
329 \membersection{wxRadioBox::SetStringSelection
}\label{wxradioboxsetstringselection
}
331 \func{void
}{SetStringSelection
}{\param{const wxString\&
}{string
}}
333 Sets the selection to a button by passing the desired string. This does not cause
334 a wxEVT
\_COMMAND\_RADIOBOX\_SELECTED event to get emitted.
336 \wxheading{Parameters
}
338 \docparam{string
}{The label of the button to select.
}
341 \membersection{wxRadioBox::Show
}\label{wxradioboxshow
}
343 \func{virtual bool
}{Show
}{\param{const bool
}{ show =
{\tt true
}}}
345 Shows or hides the entire radiobox.
347 \func{virtual bool
}{Show
}{\param{int
}{ item
},
\param{const bool
}{ show =
{\tt true
}}}
349 Shows or hides individual buttons.
351 \wxheading{Parameters
}
353 \docparam{show
}{true to show, false to hide.
}
355 \docparam{item
}{The zero-based position of the button to show or hide.
}
357 \wxheading{Return value
}
359 {\tt true
} if the box or item has been shown or hidden or
{\tt false
} if nothing was
360 done because it already was in the requested state.
364 \helpref{wxWindow::Show
}{wxwindowshow
}
366 \pythonnote{In place of a single overloaded method name, wxPython
367 implements the following methods:
\par
368 \indented{2cm
}{\begin{twocollist
}
369 \twocolitem{{\bf Show(flag)
}}{Shows or hides the entire radiobox.
}
370 \twocolitem{{\bf ShowItem(n, flag)
}}{Shows or hides individual buttons.
}