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
}}}
58 \membersection{wxRadioBox::wxRadioBox
}\label{wxradioboxctor
}
60 \func{}{wxRadioBox
}{\void}
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"
}}
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"
}}
78 Constructor, creating and showing a radiobox.
80 \wxheading{Parameters
}
82 \docparam{parent
}{Parent window. Must not be NULL.
}
84 \docparam{id
}{Window identifier. A value of -
1 indicates a default value.
}
86 \docparam{label
}{Label for the static box surrounding the radio buttons.
}
88 \docparam{pos
}{Window position. If the position (-
1, -
1) is specified then a default position is chosen.
}
90 \docparam{size
}{Window size. If the default size (-
1, -
1) is specified then a default size is chosen.
}
92 \docparam{n
}{Number of choices with which to initialize the radiobox.
}
94 \docparam{choices
}{An array of choices with which to initialize the radiobox.
}
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
99 \docparam{style
}{Window style. See
\helpref{wxRadioBox
}{wxradiobox
}.
}
101 \docparam{validator
}{Window validator.
}
103 \docparam{name
}{Window name.
}
107 \helpref{wxRadioBox::Create
}{wxradioboxcreate
},
\helpref{wxValidator
}{wxvalidator
}
109 \pythonnote{The wxRadioBox constructor in wxPython reduces the
{\tt n
}
110 and
{\tt choices
} arguments are to a single argument, which is
113 \perlnote{In wxPerl there is just an array reference in place of
{\tt n
}
116 \membersection{wxRadioBox::
\destruct{wxRadioBox
}}\label{wxradioboxdtor
}
118 \func{}{\destruct{wxRadioBox
}}{\void}
120 Destructor, destroying the radiobox item.
122 \membersection{wxRadioBox::Create
}\label{wxradioboxcreate
}
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"
}}
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"
}}
138 Creates the radiobox for two-step construction. See
\helpref{wxRadioBox::wxRadioBox
}{wxradioboxctor
}\rtfsp
141 \membersection{wxRadioBox::Enable
}\label{wxradioboxenable
}
143 \func{virtual bool
}{Enable
}{\param{bool
}{ enable =
{\tt true
}}}
145 Enables or disables the entire radiobox.
147 \func{virtual bool
}{Enable
}{\param{int
}{ n
},
\param{bool
}{ enable =
{\tt true
}}}
149 Enables or disables an individual button in the radiobox.
151 \wxheading{Parameters
}
153 \docparam{enable
}{true to enable, false to disable.
}
155 \docparam{n
}{The zero-based button to enable or disable.
}
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.
}
168 \helpref{wxWindow::Enable
}{wxwindowenable
}
171 \membersection{wxRadioBox::FindString
}\label{wxradioboxfindstring
}
173 \constfunc{int
}{FindString
}{\param{const wxString\&
}{string
}}
175 Finds a button matching the given string, returning the position if found, or
178 \wxheading{Parameters
}
180 \docparam{string
}{The string to find.
}
182 \membersection{wxRadioBox::GetCount
}\label{wxradioboxgetcount
}
184 \constfunc{int
}{GetCount
}{\void}
186 Returns the number of items in the radiobox.
188 \membersection{wxRadioBox::GetLabel
}\label{wxradioboxgetlabel
}
190 \constfunc{wxString
}{GetLabel
}{\void}
192 Returns the radiobox label.
194 \wxheading{Parameters
}
196 \docparam{n
}{The zero-based button index.
}
200 \helpref{wxRadioBox::SetLabel
}{wxradioboxsetlabel
}
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.
}
211 \membersection{wxRadioBox::GetSelection
}\label{wxradioboxgetselection
}
213 \constfunc{int
}{GetSelection
}{\void}
215 Returns the zero-based position of the selected button.
217 \membersection{wxRadioBox::GetStringSelection
}\label{wxradioboxgetstringselection
}
219 \constfunc{wxString
}{GetStringSelection
}{\void}
221 Returns the selected string.
223 \membersection{wxRadioBox::GetString
}\label{wxradioboxgetstring
}
225 \constfunc{wxString
}{GetString
}{\param{int
}{ n
}}
227 Returns the label for the button at the given position.
229 \wxheading{Parameters
}
231 \docparam{n
}{The zero-based button position.
}
233 \membersection{wxRadioBox::Number
}\label{wxradioboxnumber
}
235 \constfunc{int
}{Number
}{\void}
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
243 Returns the number of buttons in the radiobox.
245 \membersection{wxRadioBox::SetLabel
}\label{wxradioboxsetlabel
}
247 \func{void
}{SetLabel
}{\param{const wxString\&
}{ label
}}
249 Sets the radiobox label.
252 \wxheading{Parameters
}
254 \docparam{label
}{The label to set.
}
256 \docparam{n
}{The zero-based button index.
}
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.
}
266 \membersection{wxRadioBox::SetSelection
}\label{wxradioboxsetselection
}
268 \func{void
}{SetSelection
}{\param{int
}{ n
}}
270 Sets a button by passing the desired string position. This does not cause
271 a wxEVT
\_COMMAND\_RADIOBOX\_SELECTED event to get emitted.
273 \wxheading{Parameters
}
275 \docparam{n
}{The zero-based button position.
}
277 \membersection{wxRadioBox::SetStringSelection
}\label{wxradioboxsetstringselection
}
279 \func{void
}{SetStringSelection
}{\param{const wxString\&
}{string
}}
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.
284 \wxheading{Parameters
}
286 \docparam{string
}{The label of the button to select.
}
288 \membersection{wxRadioBox::Show
}\label{wxradioboxshow
}
290 \func{virtual bool
}{Show
}{\param{const bool
}{ show =
{\tt true
}}}
292 Shows or hides the entire radiobox.
294 \func{virtual bool
}{Show
}{\param{int
}{ item
},
\param{const bool
}{ show =
{\tt true
}}}
296 Shows or hides individual buttons.
298 \wxheading{Parameters
}
300 \docparam{show
}{true to show, false to hide.
}
302 \docparam{item
}{The zero-based position of the button to show or hide.
}
304 \wxheading{Return value
}
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.
311 \helpref{wxWindow::Show
}{wxwindowshow
}
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.
}