# wxRadioBox Class Reference
[Controls]

`#include <wx/radiobox.h>`

Inheritance diagram for wxRadioBox:
[legend]

## Detailed Description

A radio box item is used to select one of number of mutually exclusive choices.

It is displayed as a vertical column or horizontal row of labelled buttons.

## Styles

This class supports the following styles:

- wxRA_SPECIFY_ROWS:
  The major dimension parameter refers to the maximum number of rows.
- wxRA_SPECIFY_COLS:
  The major dimension parameter refers to the maximum number of columns.
- wxRA_USE_CHECKBOX:
  Use of the checkbox controls instead of radio buttons (currently supported only on PalmOS)

## Events emitted by this class

The following event handler macros redirect the events to member function handlers 'func' with prototypes like:

void handlerFuncName(wxCommandEvent& event)
Event macros for events emitted by this class:

- EVT_RADIOBOX(id, func):
  Process a `wxEVT_COMMAND_RADIOBOX_SELECTED` event, when a radiobutton is clicked.

##

Library: wxCore

Category: Controls
Appearance:

wxMSW appearance | wxGTK appearance | wxMac appearance

See also:
  Events and Event Handling, wxRadioButton, wxCheckBox

## Public Member Functions
| wxRadioBox ()
| Default constructor.
| wxRadioBox (wxWindow *parent, wxWindowID id, const wxString &label, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, int n=0, const wxString choices[]=NULL, int majorDimension=0, long style=wxRA_SPECIFY_COLS, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxRadioBoxNameStr)
| Constructor, creating and showing a radiobox.
| wxRadioBox (wxWindow *parent, wxWindowID id, const wxString &label, const wxPoint &pos, const wxSize &size, const wxArrayString &choices, int majorDimension=0, long style=wxRA_SPECIFY_COLS, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxRadioBoxNameStr)
| Constructor, creating and showing a radiobox.
virtual | ~wxRadioBox ()
| Destructor, destroying the radiobox item.
bool | Create (wxWindow *parent, wxWindowID id, const wxString &label, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, int n=0, const wxString choices[]=NULL, int majorDimension=0, long style=wxRA_SPECIFY_COLS, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxRadioBoxNameStr)
| Creates the radiobox for two-step construction.
bool | Create (wxWindow *parent, wxWindowID id, const wxString &label, const wxPoint &pos, const wxSize &size, const wxArrayString &choices, int majorDimension=0, long style=wxRA_SPECIFY_COLS, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxRadioBoxNameStr)
| Creates the radiobox for two-step construction.
virtual bool | Enable (unsigned int n, bool enable=true)
| Enables or disables an individual button in the radiobox.
virtual int | FindString (const wxString &string, bool bCase=false) const
| Finds a button matching the given string, returning the position if found, or `wxNOT_FOUND` if not found.
unsigned int | GetColumnCount () const
| Returns the number of columns in the radiobox.
virtual int | GetItemFromPoint (const wxPoint &pt) const
| Returns a radio box item under the point, a zero-based item index, or `wxNOT_FOUND` if no item is under the point.
wxString | GetItemHelpText (unsigned int item) const
| Returns the helptext associated with the specified item if any or `wxEmptyString`.
wxToolTip * | GetItemToolTip (unsigned int item) const
| Returns the tooltip associated with the specified item if any or NULL.
unsigned int | GetRowCount () const
| Returns the number of rows in the radiobox.
virtual bool | IsItemEnabled (unsigned int n) const
| Returns true if the item is enabled or false if it was disabled using Enable(n, false).
virtual bool | IsItemShown (unsigned int n) const
| Returns true if the item is currently shown or false if it was hidden using Show(n, false).
void | SetItemHelpText (unsigned int item, const wxString &helptext)
| Sets the helptext for an item.
void | SetItemToolTip (unsigned int item, const wxString &text)
| Sets the tooltip text for the specified item in the radio group.
virtual bool | Show (unsigned int item, bool show=true)
| Shows or hides individual buttons.

List of all members.

## Constructor & Destructor Documentation

wxRadioBox::wxRadioBox | ( |  | ) |

Default constructor.

See also:
  Create(), wxValidator

wxRadioBox::wxRadioBox | ( | wxWindow * | parent,
|  | wxWindowID | id,
|  | const wxString & | label,
|  | const wxPoint & | pos = `wxDefaultPosition`,
|  | const wxSize & | size = `wxDefaultSize`,
|  | int | n = `0`,
|  | const wxString | choices[] = `NULL`,
|  | int | majorDimension = `0`,
|  | long | style = `wxRA_SPECIFY_COLS`,
|  | const wxValidator & | validator = `wxDefaultValidator`,
|  | const wxString & | name = `wxRadioBoxNameStr` |
| ) |  |  |

Constructor, creating and showing a radiobox.

Parameters:

  | parent | Parent window. Must not be NULL.
  | id | Window identifier. The value `wxID_ANY` indicates a default value.
  | label | Label for the static box surrounding the radio buttons.
  | pos | Window position. If wxDefaultPosition is specified then a default position is chosen.
  | size | Window size. If wxDefaultSize is specified then a default size is chosen.
  | n | Number of choices with which to initialize the radiobox.
  | choices | An array of choices with which to initialize the radiobox.
  | 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 radiobox. The default value of 0 means to use the number of items, i.e. n.
  | style | Window style. See wxRadioBox.
  | validator | Window validator.
  | name | Window name.

wxPerl Note: Not supported by wxPerl.

See also:
  Create(), wxValidator

wxRadioBox::wxRadioBox | ( | wxWindow * | parent,
|  | wxWindowID | id,
|  | const wxString & | label,
|  | const wxPoint & | pos,
|  | const wxSize & | size,
|  | const wxArrayString & | choices,
|  | int | majorDimension = `0`,
|  | long | style = `wxRA_SPECIFY_COLS`,
|  | const wxValidator & | validator = `wxDefaultValidator`,
|  | const wxString & | name = `wxRadioBoxNameStr` |
| ) |  |  |

Constructor, creating and showing a radiobox.

Parameters:

  | parent | Parent window. Must not be NULL.
  | id | Window identifier. The value `wxID_ANY` indicates a default value.
  | label | Label for the static box surrounding the radio buttons.
  | pos | Window position. If wxDefaultPosition is specified then a default position is chosen.
  | size | Window size. If wxDefaultSize is specified then a default size is chosen.
  | choices | An array of choices with which to initialize the radiobox.
  | 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 radiobox. The default value of 0 means to use the number of items, i.e. number of elements in choices.
  | style | Window style. See wxRadioBox.
  | validator | Window validator.
  | name | Window name.

wxPerl Note: Use an array reference for the choices parameter.

See also:
  Create(), wxValidator

virtual wxRadioBox::~wxRadioBox | ( |  | ) | `[virtual]`

Destructor, destroying the radiobox item.

## Member Function Documentation

bool wxRadioBox::Create | ( | wxWindow * | parent,
|  | wxWindowID | id,
|  | const wxString & | label,
|  | const wxPoint & | pos,
|  | const wxSize & | size,
|  | const wxArrayString & | choices,
|  | int | majorDimension = `0`,
|  | long | style = `wxRA_SPECIFY_COLS`,
|  | const wxValidator & | validator = `wxDefaultValidator`,
|  | const wxString & | name = `wxRadioBoxNameStr` |
| ) |  |  |

Creates the radiobox for two-step construction.

See wxRadioBox() for further details.

bool wxRadioBox::Create | ( | wxWindow * | parent,
|  | wxWindowID | id,
|  | const wxString & | label,
|  | const wxPoint & | pos = `wxDefaultPosition`,
|  | const wxSize & | size = `wxDefaultSize`,
|  | int | n = `0`,
|  | const wxString | choices[] = `NULL`,
|  | int | majorDimension = `0`,
|  | long | style = `wxRA_SPECIFY_COLS`,
|  | const wxValidator & | validator = `wxDefaultValidator`,
|  | const wxString & | name = `wxRadioBoxNameStr` |
| ) |  |  |

Creates the radiobox for two-step construction.

See wxRadioBox() for further details.

virtual bool wxRadioBox::Enable | ( | unsigned int | n,
|  | bool | enable = `true` |
| ) |  |  | `[virtual]`

Enables or disables an individual button in the radiobox.

Parameters:

  | enable | true to enable, false to disable.
  | n | The zero-based button to enable or disable.

See also:
  wxWindow::Enable()

wxPython Note: In place of a single overloaded method name, wxPython implements the following methods:

Enable(flag) | Enables or disables the entire radiobox.
EnableItem(n, flag) | Enables or disables an individual button in the radiobox.

virtual int wxRadioBox::FindString | ( | const wxString & | string,
|  | bool | bCase = `false` |
| ) |  |  | const`[virtual]`

Finds a button matching the given string, returning the position if found, or `wxNOT_FOUND` if not found.

Parameters:

  | string | The string to find.
  | bCase | Should the search be case-sensitive?

Reimplemented from wxItemContainerImmutable.

unsigned int wxRadioBox::GetColumnCount | ( |  | ) | const

Returns the number of columns in the radiobox.

virtual int wxRadioBox::GetItemFromPoint | ( | const wxPoint & | pt | ) | const`[virtual]`

Returns a radio box item under the point, a zero-based item index, or `wxNOT_FOUND` if no item is under the point.

Parameters:

  | pt | Point in client coordinates.

wxString wxRadioBox::GetItemHelpText | ( | unsigned int | item | ) | const

Returns the helptext associated with the specified item if any or `wxEmptyString`.

Parameters:

  | item | The zero-based item index.

See also:
  SetItemHelpText()

wxToolTip* wxRadioBox::GetItemToolTip | ( | unsigned int | item | ) | const

Returns the tooltip associated with the specified item if any or NULL.

See also:
  SetItemToolTip(), wxWindow::GetToolTip()

unsigned int wxRadioBox::GetRowCount | ( |  | ) | const

Returns the number of rows in the radiobox.

virtual bool wxRadioBox::IsItemEnabled | ( | unsigned int | n | ) | const`[virtual]`

Returns true if the item is enabled or false if it was disabled using Enable(n, false).

This function is currently only implemented in wxMSW, wxGTK and wxUniversal and always returns true in the other ports.

Parameters:

  | n | The zero-based button position.

virtual bool wxRadioBox::IsItemShown | ( | unsigned int | n | ) | const`[virtual]`

Returns true if the item is currently shown or false if it was hidden using Show(n, false).

Note that this function returns true for an item which hadn't been hidden even if the entire radiobox is not currently shown.

This function is currently only implemented in wxMSW, wxGTK and wxUniversal and always returns true in the other ports.

Parameters:

  | n | The zero-based button position.

void wxRadioBox::SetItemHelpText | ( | unsigned int | item,
|  | const wxString & | helptext |
| ) |  |  |

Sets the helptext for an item.

Empty string erases any existing helptext.

Parameters:

  | item | The zero-based item index.
  | helptext | The help text to set for the item.

See also:
  GetItemHelpText()

void wxRadioBox::SetItemToolTip | ( | unsigned int | item,
|  | const wxString & | text |
| ) |  |  |

Sets the tooltip text for the specified item in the radio group.

This function is currently only implemented in wxMSW and wxGTK2 and does nothing in the other ports.

Parameters:

  | item | Index of the item the tooltip will be shown for.
  | text | Tooltip text for the item, the tooltip is removed if empty.

See also:
  GetItemToolTip(), wxWindow::SetToolTip()

virtual bool wxRadioBox::Show | ( | unsigned int | item,
|  | bool | show = `true` |
| ) |  |  | `[virtual]`

Shows or hides individual buttons.

Parameters:

  | show | true to show, false to hide.
  | item | The zero-based position of the button to show or hide.

Returns:
  true if the item has been shown or hidden or false if nothing was done because it already was in the requested state.

See also:
  wxWindow::Show()

wxPython Note: In place of a single overloaded method name, wxPython implements the following methods:

Show(flag) | Shows or hides the entire radiobox.
ShowItem(n, flag) | Shows or hides individual buttons.

|  | [ top ]