Hello to all! Help, who can, deal with the specifics of the CEventCallback in the Marmalade SDK.
I created 2 classes, GUIElement (prt) and SceneOne (derived). In the descendant I need to pull one of the methods of the base class on the event of clicking on the button.
But something is failing to create an adequate custom handler ... In the examples in m2kit, in the button section, the developers made such a function in main ():
void btnClicked() { /*some code*/ } Ie, the function is not a member of any class, it is simply declared in sight. And in Maine they simply pass it as an argument to:
btn->SubscribeEvent(BUTTON_CLICK, btnClicked); And everything works correctly.
But my program should be a bit more complicated =) I need to create my own handler that belongs to the SceneOne class, but I constantly run into an error.
argument of type "void (SceneOne::*)(m2dkit::core::CEventArgs *args)" is incompatible with parameter of type "m2dkit::core::CEventCallback" I also tried to pass such an option as a callback, but the result did not give because there is no possibility to bring the function to the desired type:
std::bind(&SceneOne::btnPressed, this, std::placeholders::_1) Additional info: Scene - http://prntscr.com/bx9np4 | http://prntscr.com/bx9nz7
UPD: When I make a handler method static - it is accepted correctly in SubscribeEvent, but then you cannot pull NOT static methods from the function static. It turns out there are 2 ways and in both a problem ...
CEventArgscan give a link? - Vladimir Gamalyanm_Sourcefield in theargshandler, this is yourbtnlike. - Vladimir Gamalyan