Hello There !
I have a vector (std:vector) of 10 Buttons and I am doing an iteration to set some properties on them.
I am also, setting a ofAddListener to each Button inside the Iteration.
the Event sent is of type ofTouchEventArgs
How can I create just one Function that will be triggered on this listener, but receives the Button as parameter (or a custom parameter that identifies which Button has been clicked )
Code time: (just the important stuff)
//
for (; iterator != buttons.end(); ++iterator){
ofAddListener( iterator->onPress, this, &ofApp::theOneFunctionToListenThemAll);
}
void ofApp::theOneFunctionToListenThemAll(ofTouchEventArgs & args){
// Which Button was pressed ?
}
Thanks in advance