Thanks for the detailed description and sample code, I was able to quickly track down the bug in TGUI. There is a branch in setPosition that doesn't actually set any position (when KeepInParent is true and the provided position isn't outside the parent).
A workaround would be to call setKeepInParent(false) right before you call setPosition.
The issue has now been fixed in the latest development version.
You can do the same for the other static variables.
A workaround would be to call setKeepInParent(false) right before you call setPosition.
The issue has now been fixed in the latest development version.
QuoteUsing separated lambdas for each button which are not aware of status of the seconds is not ideal. Is there another way to do it?You can move the state outside the lambda and let the lambda functions take a reference to it. Your lambda already starts with "[&]", so it already has access to all variables outside it by reference. You just have to be careful that the referenced parameter doesn't go out of scope and gets destroyed before the lambda is called.
Code (cpp) Select
bool maximized = false;
bool minimized = false
childWindow->onMaximize([&](){
// You can use 'minimized' here as well.
// Make sure to remove the "static bool maximized (false);" line from this lambda
});
childWindow->onMinimize([&](){
// You can use 'maximized' here as well.
// Make sure to remove the "static bool minimized (false);" line from this lambda
});
You can do the same for the other static variables.