Trouble adding listener with 0.06 event system


I’m just trying to register my class to act as a mouse listener… but I get an error when I do

ofAddListener(ofEvents.keyPressed, this, &GuiHandler::keyPressed);

this is called from within GuiHandler’s constructor, and GuiHandler does have the method:
void keyPressed(int key);

I get this error:
error: no matching function for call to ‘ofAddListener(ofEvent&, GuiHandler* const, void (GuiHandler::*)(int))’

I’m still learning the new event system, so surely it’s something simple?


try: void keyPressed(ofKeyEventArgs & _args);

from ofEventUtils.h

// register any method of any class to an event.  
// the method must provide one of the following  
// signatures:  
//     void method(ArgumentsType & args)  
//     void method(const void * sender, ArgumentsType &args)  
// ie:  
//     ofAddListener(addon.newIntEvent, this, &Class::method)  

in ofEvents.h you find all defined ofCoreEvents avaiable


Hmm… thought I tried that yesterday when I was messing with it.

Oh well, it works! Thanks lian!