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{wxControlWithItems
}{wxcontrolwithitems
}\\
21 \helpref{wxControl
}{wxcontrol
}\\
22 \helpref{wxWindow
}{wxwindow
}\\
23 \helpref{wxEvtHandler
}{wxevthandler
}\\
24 \helpref{wxObject
}{wxobject
}
26 \wxheading{Include files
}
32 \helpref{wxCore
}{librarieslist
}
34 \wxheading{Window styles
}
37 \begin{twocollist
}\itemsep=
0pt
38 \twocolitem{\windowstyle{wxRA
\_SPECIFY\_ROWS}}{The major dimension parameter refers to the
39 maximum number of rows.
}
40 \twocolitem{\windowstyle{wxRA
\_SPECIFY\_COLS}}{The major dimension parameter refers to the
41 maximum number of columns.
}
42 \twocolitem{\windowstyle{wxRA
\_USE\_CHECKBOX}}{Use of the checkbox controls instead of radio
43 buttons (currently supported only on PalmOS)
}
46 See also
\helpref{window styles overview
}{windowstyles
}.
48 \wxheading{Event handling
}
51 \begin{twocollist
}\itemsep=
0pt
52 \twocolitem{{\bf EVT
\_RADIOBOX(id, func)
}}{Process a wxEVT
\_COMMAND\_RADIOBOX\_SELECTED event,
53 when a radiobutton is clicked.
}
58 \helpref{Event handling overview
}{eventhandlingoverview
},
\helpref{wxRadioButton
}{wxradiobutton
},
\rtfsp
59 \helpref{wxCheckBox
}{wxcheckbox
}
61 \latexignore{\rtfignore{\wxheading{Members
}}}
64 \membersection{wxRadioBox::wxRadioBox
}\label{wxradioboxctor
}
66 \func{}{wxRadioBox
}{\void}
70 \func{}{wxRadioBox
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{id
},
\param{const wxString\&
}{label
},
\rtfsp
71 \param{const wxPoint\&
}{point = wxDefaultPosition
},
\param{const wxSize\&
}{size = wxDefaultSize
},
\rtfsp
72 \param{int
}{ n =
0},
\param{const wxString
}{ choices
[] = NULL
},
\rtfsp
73 \param{int
}{ majorDimension =
0},
\param{long
}{ style = wxRA
\_SPECIFY\_COLS},
\rtfsp
74 \param{const wxValidator\&
}{validator = wxDefaultValidator
},
\rtfsp
75 \param{const wxString\&
}{name = ``radioBox"
}}
77 \func{}{wxRadioBox
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{id
},
\param{const wxString\&
}{label
},
\rtfsp
78 \param{const wxPoint\&
}{point
},
\param{const wxSize\&
}{size
},
\rtfsp
79 \param{const wxArrayString\&
}{ choices
},
\rtfsp
80 \param{int
}{ majorDimension =
0},
\param{long
}{ style = wxRA
\_SPECIFY\_COLS},
\rtfsp
81 \param{const wxValidator\&
}{validator = wxDefaultValidator
},
\rtfsp
82 \param{const wxString\&
}{name = ``radioBox"
}}
84 Constructor, creating and showing a radiobox.
86 \wxheading{Parameters
}
88 \docparam{parent
}{Parent window. Must not be NULL.
}
90 \docparam{id
}{Window identifier. A value of -
1 indicates a default value.
}
92 \docparam{label
}{Label for the static box surrounding the radio buttons.
}
94 \docparam{pos
}{Window position. If the position (-
1, -
1) is specified then a default position is chosen.
}
96 \docparam{size
}{Window size. If the default size (-
1, -
1) is specified then a default size is chosen.
}
98 \docparam{n
}{Number of choices with which to initialize the radiobox.
}
100 \docparam{choices
}{An array of choices with which to initialize the radiobox.
}
102 \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
105 \docparam{style
}{Window style. See
\helpref{wxRadioBox
}{wxradiobox
}.
}
107 \docparam{validator
}{Window validator.
}
109 \docparam{name
}{Window name.
}
113 \helpref{wxRadioBox::Create
}{wxradioboxcreate
},
\helpref{wxValidator
}{wxvalidator
}
115 \pythonnote{The wxRadioBox constructor in wxPython reduces the
{\tt n
}
116 and
{\tt choices
} arguments are to a single argument, which is
119 \perlnote{In wxPerl there is just an array reference in place of
{\tt n
}
123 \membersection{wxRadioBox::
\destruct{wxRadioBox
}}\label{wxradioboxdtor
}
125 \func{}{\destruct{wxRadioBox
}}{\void}
127 Destructor, destroying the radiobox item.
130 \membersection{wxRadioBox::Create
}\label{wxradioboxcreate
}
132 \func{bool
}{Create
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{id
},
\param{const wxString\&
}{label
},
\rtfsp
133 \param{const wxPoint\&
}{point = wxDefaultPosition
},
\param{const wxSize\&
}{size = wxDefaultSize
},
\rtfsp
134 \param{int
}{ n =
0},
\param{const wxString
}{ choices
[] = NULL
},
\rtfsp
135 \param{int
}{ majorDimension =
0},
\param{long
}{ style = wxRA
\_SPECIFY\_COLS},
\rtfsp
136 \param{const wxValidator\&
}{validator = wxDefaultValidator
},
\rtfsp
137 \param{const wxString\&
}{name = ``radioBox"
}}
139 \func{bool
}{Create
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{id
},
\param{const wxString\&
}{label
},
\rtfsp
140 \param{const wxPoint\&
}{point
},
\param{const wxSize\&
}{size
},
\rtfsp
141 \param{const wxArrayString\&
}{ choices
},
\rtfsp
142 \param{int
}{ majorDimension =
0},
\param{long
}{ style = wxRA
\_SPECIFY\_COLS},
\rtfsp
143 \param{const wxValidator\&
}{validator = wxDefaultValidator
},
\rtfsp
144 \param{const wxString\&
}{name = ``radioBox"
}}
146 Creates the radiobox for two-step construction. See
\helpref{wxRadioBox::wxRadioBox
}{wxradioboxctor
}\rtfsp
150 \membersection{wxRadioBox::Enable
}\label{wxradioboxenable
}
152 \func{virtual bool
}{Enable
}{\param{bool
}{ enable =
{\tt true
}}}
154 Enables or disables the entire radiobox.
156 \func{virtual bool
}{Enable
}{\param{unsigned int
}{ n
},
\param{bool
}{ enable =
{\tt true
}}}
158 Enables or disables an individual button in the radiobox.
160 \wxheading{Parameters
}
162 \docparam{enable
}{true to enable, false to disable.
}
164 \docparam{n
}{The zero-based button to enable or disable.
}
166 \pythonnote{In place of a single overloaded method name, wxPython
167 implements the following methods:
\par
168 \indented{2cm
}{\begin{twocollist
}
169 \twocolitem{{\bf Enable(flag)
}}{Enables or disables the entire radiobox.
}
170 \twocolitem{{\bf EnableItem(n, flag)
}}{Enables or disables an
171 individual button in the radiobox.
}
177 \helpref{wxWindow::Enable
}{wxwindowenable
}
181 \membersection{wxRadioBox::FindString
}\label{wxradioboxfindstring
}
183 \constfunc{int
}{FindString
}{\param{const wxString\&
}{string
}}
185 Finds a button matching the given string, returning the position if found, or
188 \wxheading{Parameters
}
190 \docparam{string
}{The string to find.
}
193 \membersection{wxRadioBox::GetColumnCount
}\label{wxradioboxgetcolumncount
}
195 \constfunc{unsigned int
}{GetColumnCount
}{\void}
197 Returns the number of columns in the radiobox.
200 \membersection{wxRadioBox::GetItemHelpText
}\label{wxradioboxgetitemhelptext
}
202 \constfunc{wxString
}{GetItemHelpText
}{\param{unsigned int
}{ item
}}
204 Returns the helptext associated with the specified
\arg{item
} if any or
{\tt wxEmptyString
}.
206 \wxheading{Parameters
}
208 \docparam{item
}{The zero-based item index.
}
212 \helpref{SetItemHelpText
}{wxradioboxsetitemhelptext
}
215 \membersection{wxRadioBox::GetItemToolTip
}\label{wxradioboxgetitemtooltip
}
217 \constfunc{wxToolTip *
}{GetItemToolTip
}{\param{unsigned int
}{ item
}}
219 Returns the tooltip associated with the specified
\arg{item
} if any or
\NULL.
223 \helpref{SetItemToolTip
}{wxradioboxsetitemtooltip
},\\
224 \helpref{wxWindow::GetToolTip
}{wxwindowgettooltip
}
227 \membersection{wxRadioBox::GetItemFromPoint
}\label{wxradioboxgetitemfrompoint
}
229 \constfunc{int
}{GetItemFromPoint
}{\param{const wxPoint&
}{ pt
}}
231 Returns a radio box item under the point, a zero-based item index, or
{\tt wxNOT
\_FOUND} if no item is under the point.
233 \docparam{pt
}{Point in client coordinates.
}
236 \membersection{wxRadioBox::GetLabel
}\label{wxradioboxgetlabel
}
238 \constfunc{wxString
}{GetLabel
}{\void}
240 Returns the radiobox label.
242 \wxheading{Parameters
}
244 \docparam{n
}{The zero-based button index.
}
248 \helpref{wxRadioBox::SetLabel
}{wxradioboxsetlabel
}
250 \pythonnote{In place of a single overloaded method name, wxPython
251 implements the following methods:
\par
252 \indented{2cm
}{\begin{twocollist
}
253 \twocolitem{{\bf GetLabel()
}}{Returns the radiobox label.
}
254 \twocolitem{{\bf GetItemLabel(n)
}}{Returns the label for the given button.
}
259 \membersection{wxRadioBox::GetRowCount
}\label{wxradioboxgetrowcount
}
261 \constfunc{unsigned int
}{GetRowCount
}{\void}
263 Returns the number of rows in the radiobox.
266 \membersection{wxRadioBox::GetSelection
}\label{wxradioboxgetselection
}
268 \constfunc{int
}{GetSelection
}{\void}
270 Returns the zero-based position of the selected button.
273 \membersection{wxRadioBox::GetStringSelection
}\label{wxradioboxgetstringselection
}
275 \constfunc{wxString
}{GetStringSelection
}{\void}
277 Returns the selected string.
280 \membersection{wxRadioBox::GetString
}\label{wxradioboxgetstring
}
282 \constfunc{wxString
}{GetString
}{\param{unsigned int
}{ n
}}
284 Returns the label for the button at the given position.
286 \wxheading{Parameters
}
288 \docparam{n
}{The zero-based button position.
}
291 \membersection{wxRadioBox::IsItemEnabled
}\label{wxradioboxisitemenabled
}
293 \constfunc{bool
}{IsItemEnabled
}{\param{unsigned int
}{ n
}}
295 Returns
\true if the item is enabled or
\false if it was disabled using
296 \helpref{Enable(n, false)
}{wxradioboxenable
}.
298 {\bf Platform note:
} Currently only implemented in wxMSW, wxGTK and wxUniversal
299 and always returns
\true in the other ports.
301 \wxheading{Parameters
}
303 \docparam{n
}{The zero-based button position.
}
306 \membersection{wxRadioBox::IsItemShown
}\label{wxradioboxisitemshown
}
308 \constfunc{bool
}{IsItemShown
}{\param{unsigned int
}{ n
}}
310 Returns
\true if the item is currently shown or
\false if it was hidden using
311 \helpref{Show(n, false)
}{wxradioboxshow
}.
313 Note that this function returns
\true for an item which hadn't been hidden even
314 if the entire radiobox is not currently shown.
316 {\bf Platform note:
} Currently only implemented in wxMSW, wxGTK and wxUniversal
317 and always returns
\true in the other ports.
319 \wxheading{Parameters
}
321 \docparam{n
}{The zero-based button position.
}
324 \membersection{wxRadioBox::SetItemHelpText
}\label{wxradioboxsetitemhelptext
}
326 \func{void
}{SetItemHelpText
}{\param{unsigned int
}{ item
},
\param{const wxString\&
}{ helptext
}}
328 Sets the helptext for an item. Empty string erases any existing helptext.
330 \wxheading{Parameters
}
332 \docparam{item
}{The zero-based item index.
}
334 \docparam{helptext
}{The help text to set for the item.
}
338 \helpref{GetItemHelpText
}{wxradioboxgetitemhelptext
}
341 \membersection{wxRadioBox::SetLabel
}\label{wxradioboxsetlabel
}
343 \func{void
}{SetLabel
}{\param{const wxString\&
}{ label
}}
345 Sets the radiobox label.
348 \wxheading{Parameters
}
350 \docparam{label
}{The label to set.
}
352 \docparam{n
}{The zero-based button index.
}
354 \pythonnote{In place of a single overloaded method name, wxPython
355 implements the following methods:
\par
356 \indented{2cm
}{\begin{twocollist
}
357 \twocolitem{{\bf SetLabel(string)
}}{Sets the radiobox label.
}
358 \twocolitem{{\bf SetItemLabel(n, string)
}}{Sets a label for a radio button.
}
363 \membersection{wxRadioBox::SetSelection
}\label{wxradioboxsetselection
}
365 \func{void
}{SetSelection
}{\param{int
}{ n
}}
367 Sets a button by passing the desired string position. This does not cause
368 a wxEVT
\_COMMAND\_RADIOBOX\_SELECTED event to get emitted.
370 \wxheading{Parameters
}
372 \docparam{n
}{The zero-based button position.
}
375 \membersection{wxRadioBox::SetStringSelection
}\label{wxradioboxsetstringselection
}
377 \func{void
}{SetStringSelection
}{\param{const wxString\&
}{string
}}
379 Sets the selection to a button by passing the desired string. This does not cause
380 a wxEVT
\_COMMAND\_RADIOBOX\_SELECTED event to get emitted.
382 \wxheading{Parameters
}
384 \docparam{string
}{The label of the button to select.
}
387 \membersection{wxRadioBox::SetItemToolTip
}\label{wxradioboxsetitemtooltip
}
389 \func{void
}{SetItemToolTip
}{\param{unsigned int
}{ item
},
\param{const wxString\&
}{text
}}
391 Sets the tooltip text for the specified item in the radio group.
393 {\bf Platform note:
} Currently only implemented in wxMSW and wxGTK2 and does
394 nothing in the other ports.
396 \wxheading{Parameters
}
398 \docparam{item
}{Index of the item the tooltip will be shown for.
}
400 \docparam{text
}{Tooltip text for the item, the tooltip is removed if empty.
}
404 \helpref{GetItemToolTip
}{wxradioboxgetitemtooltip
},\\
405 \helpref{wxWindow::SetToolTip
}{wxwindowsettooltip
}
408 \membersection{wxRadioBox::Show
}\label{wxradioboxshow
}
410 \func{virtual bool
}{Show
}{\param{const bool
}{ show =
{\tt true
}}}
412 Shows or hides the entire radiobox.
414 \func{virtual bool
}{Show
}{\param{unsigned int
}{ item
},
\param{const bool
}{ show =
{\tt true
}}}
416 Shows or hides individual buttons.
418 \wxheading{Parameters
}
420 \docparam{show
}{true to show, false to hide.
}
422 \docparam{item
}{The zero-based position of the button to show or hide.
}
424 \wxheading{Return value
}
426 {\tt true
} if the box or item has been shown or hidden or
{\tt false
} if nothing was
427 done because it already was in the requested state.
431 \helpref{wxWindow::Show
}{wxwindowshow
}
433 \pythonnote{In place of a single overloaded method name, wxPython
434 implements the following methods:
\par
435 \indented{2cm
}{\begin{twocollist
}
436 \twocolitem{{\bf Show(flag)
}}{Shows or hides the entire radiobox.
}
437 \twocolitem{{\bf ShowItem(n, flag)
}}{Shows or hides individual buttons.
}