2019-05-22 04:56 AM
Hi,
When using the 'setAction' function of the class Button, why can't I pass a callback object taking one more parameter than just the "const touchgfx::AbstractButtonContainer&"?
Here's my CallBack object with its corresponding handler function:
Callback<NumpadBis, const touchgfx::AbstractButtonContainer&, const int> _keyPressed;
void keyPressedHandler(const touchgfx::AbstractButtonContainer& src, const int);
And this doesn't work:
aKey->setAction(_keyPressed);
While it works just fine if I remove the "int" param.
Solved! Go to Solution.
2019-05-23 01:58 AM
Because the internals of the Button execute the callback with just one parameter - The handler and Callback object must match. You can just do your own implementation of a button that defines a different callback, executes the callback internally with your additional parameters - Allowing you to specify a matching handler that takes multiple arguments.
/Martin
2019-05-23 01:58 AM
Because the internals of the Button execute the callback with just one parameter - The handler and Callback object must match. You can just do your own implementation of a button that defines a different callback, executes the callback internally with your additional parameters - Allowing you to specify a matching handler that takes multiple arguments.
/Martin