[SOLVED] How to pass the Object to ofAddListener

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

Allright, after some digging found out how to get the Object (Sender) who triggered the event:

void ofApp::theOneFunctionToListenThemAll(const void * sender, ofTouchEventArgs & args){
   CLASS_TYPE * myObj = static_cast<CLASS_TYPE*>(const_cast<void*>(_sender));  

Hope it helps anyone aswell