#include <Wt/WRadioButton>
Public Member Functions | |
WRadioButton (WContainerWidget *parent=0) | |
Create an unchecked radio button with empty label and optional parent. | |
WRadioButton (const WString &text, WContainerWidget *parent=0) | |
Create an unchecked radio button with given text and optional parent. | |
~WRadioButton () | |
Delete a radio button. | |
WButtonGroup * | group () const |
Return the button group. |
Use a WButtonGroup to group together radio buttons that reflect options that are mutually exclusive.
Usage example:
enum Vote { Republican = 1, Democrate = 2, NoVote = 10 }; // use a group box as widget container for 3 radio buttons, with a title Wt::WGroupBox *container = new Wt::WGroupBox("USA elections vote"); // use a button group to logically group the 3 options Wt::WButtonGroup *group = new Wt::WButtonGroup(this); Wt::WRadioButton *button; button = new Wt::WRadioButton("I voted Republican", container); new Wt::WBreak(container); group->addButton(button, Republican); button = new Wt::WRadioButton("I voted Democrat", container); new Wt::WBreak(container); group->addButton(button, Democrate); button = new Wt::WRadioButton("I didn't vote", container); new Wt::WBreak(container); group->addButton(button, NoVote); group->setCheckedButton(group->button(NoVote));
The widget corresponds to the HTML <input type="radio">
tag.
WRadioButton is an inline widget.
WButtonGroup* Wt::WRadioButton::group | ( | ) | const [inline] |
Return the button group.
Returns the button group to which this button belongs.