Optional and Custom Parameter Signal Callback

Started by rbenn674, 05 December 2022, 04:23:12


When you have both optional and custom callback parameters ie:
button4->onPress([](int customValue, tgui::String buttonText){ /* ... */ }, 5);
How do you do the same thing with a function pass?

For instance, you do this to get the button text by itself:
void buttonPressedCallback2(tgui::String buttonText);

But say I have a custom parameter as well I want to pass to the function as well, I can't find a way to make it work except with using Lambdas.


It should be exactly the same as with the lambda, so like this:
Code (cpp) Select
void buttonPressedCallback2(int customValue, tgui::String buttonText);
button4->onPress(&buttonPressedCallback2, 5);