I have something that has to be simple but I just can't work through it in my head.
If I setup a Component to be relative to another component I end up getting 2 calls to "resized". The first with the Left,Top being set and then another one once the Width and Height are set. Am I doing something wrong?
projectWizard->setBounds("((effectControlComponent.left) / 2) - 340, ((presetControlComponent.top) / 2) - 238, left + 680, top + 477");
if I change effectControlComponents location or presetControlComponents loaction projectWizard::resized() gets called twice.
void applyToComponentBounds()
{
for (int i = 4; --i >= 0;)
{
ComponentScope scope (getComponent());
const Rectangle<int> newBounds (rectangle.resolve (&scope).getSmallestIntegerContainer());
if (newBounds == getComponent().getBounds())
return;
getComponent().setBounds (newBounds);
}
jassertfalse; // Seems to be a recursive reference!
}
Jules, what's the logic behind running this up to four times but no more? I was hitting the assertation the other day with something positioning based on its parent. I couldn't see how I'd hit a recursive reference and just worked around it...
It's a pretty arbitrary number, as I assumed nobody would be using layouts with more than 4 levels of nested dependencies.. I'll change it to a bigger value, as that'd still trigger the assertion in a real recursive situation.