I am using the Wt C++ library in a project. I am trying to use the connect(...)
function to connect a slot to a button press. The documentation for the connect(...)
function can be found here.
Essentially, each time a change is detected in a group of radio buttons, the function passed as a pointer to the connect(...)
function is called.
Below is a short snippet of the code:
...
_group = new Wt::WButtonGroup(this);
Wt::WRadioButton *button;
button = new Wt::WRadioButton("Radio Button 0", this);
_group->addButton(button, 0);
_group->setSelectedButtonIndex(0); // Select the first button by default.
_group->checkedChanged().connect(this, (&MyWidget::RadioButtonToggle)); //Need to pass parameter here
...
I need to pass the selection
parameter to the functionRadioButtonToggle(Wt::WRadioButton *selection)
so that I can use it in the function body as seen below:
void CycleTimesWidget::RadioButtonToggle(Wt::WRadioButton *selection)
{
switch (_group->id(selection))
{
case 0:
{
//Do something...
break;
}
}
}
How can I pass a parameter along with this function pointer?