Hello,
I have the following issue in my Resized() Function in my MainComponent. I want that the User can change the audiosettings and I was following the tutorial to make the audioSettings visible. Now I have a preferences button and if I click that button the audioSettings are getting visible or invisible. The issue arises now since I want to make my maincomponent wrap around the drawn content. Like I have kind of like a mixing desk visible and underneath the desk should appear the audioSettings whenever the user clicks the button. Now since I make the MainComponent react to the size of the content, I get into a resized() loop where I can’t really figure out how to escape it.
First here is the pseudo code:
void MainComponent::resized()
{
if(!audioSettings->isVisible())
{
setSize(slotComponents_.size() * slotWidth_ + preferenceButton_.getWidth() + 20, slotHeight_);
}
else {
setSize(audioSettings->getWidth() + preferenceButton_.getWidth() + 20, slotHeight_ + audioSettings->getHeight());
}
}
In the example I left out the if statement to check if all my Slots are wider than my audioSettings. But aleady with the code above I get into a recursive call of my resized() function. The pseudo code lives in the resized() function. The result is that it scales up till it’s too big and an exception is thrown. I figured with debug that the following function is causing the recursive call:
juce::Component::sendMovedResizedMessages(bool wasMoved, bool wasResized)
It would be nice if I could do if statements in the resize function without getting in the recursive calls. I had it almost working but the width of my maincomponent was too small to show the hole content of the audioSettings.
Please note also, I’m aware that if I use Flexbox and Gridlayout, I would achieve that also, but for now I wanna stick to the traditional way of making a gui for my audioapp.
Thank you in advance,
LaZzle