PaulM1985
February 21st, 2010, 05:40 PM
Hi
I am creating a program which will display a variable number of buttons depending on the system state. Since there will be a varied amount, I want to use one function to respond to any of the clicks and then deal with the click in the function.
for (int i = 0; i < m_Button.length(); i++) {
m_Button[i].signal_clicked().connect(sigc::mem_fun(*this,
&NavPanel::OnButtonClick));
}
Then in OnButtonClick:
void NavPanel::OnButtonClick() {
// Know which button from the list was clicked
}
Maybe somehow passing in some sort of argument into the OnButtonClick function, the index of the button in the list perhaps.
Is this possible and does the question make sense?
Paul
I am creating a program which will display a variable number of buttons depending on the system state. Since there will be a varied amount, I want to use one function to respond to any of the clicks and then deal with the click in the function.
for (int i = 0; i < m_Button.length(); i++) {
m_Button[i].signal_clicked().connect(sigc::mem_fun(*this,
&NavPanel::OnButtonClick));
}
Then in OnButtonClick:
void NavPanel::OnButtonClick() {
// Know which button from the list was clicked
}
Maybe somehow passing in some sort of argument into the OnButtonClick function, the index of the button in the list perhaps.
Is this possible and does the question make sense?
Paul