I am trying to use the StretchableLayoutManager to be able to change the position of the Panel separator.
The sample code (extract) is below.
(The entire sample code is attached at the end)
// in MainComponent variables
MainPanel mainPanel; // Inherited juce::Component
SidePanel sidePanel; // Inherited juce::Component
juce::StretchableLayoutManager stretchableManager;
juce::StretchableLayoutResizerBar resizerBar{ &stretchableManager, 1, true };
MainComponent::MainComponent()
{
addAndMakeVisible(mainPanel);
addAndMakeVisible(resizerBar);
addAndMakeVisible(sidePanel);
constexpr int separatorThickness(8);
stretchableManager.setItemLayout(0, 1, 10000, 1000);
stretchableManager.setItemLayout(1, separatorThickness, separatorThickness, separatorThickness);
stretchableManager.setItemLayout(2, 100, 300, 300);
setSize (600, 400);
}
void MainComponent::resized()
{
Component* comps[] = { &mainPanel, &resizerBar, &sidePanel };
auto r(getLocalBounds());
stretchableManager.layOutComponents(comps, 3, r.getX(), r.getY(), r.getWidth(), r.getHeight(), false, true);
}
SidePanel is implemented in such a way that it should not be larger than 300pixels.
There is no problem for launching the application with this implementation and operating the resizerbar.
However, if the width of the SidePanel is set to 300 pixels beforehand and the screen size of the entire application is increased, the width of the SidePanel can be changed to more than 300 pixels.
What I want to do is to keep the maximum width of the SidePanel at 300pixel, even if the screen size is changed.
Is this a bug in JUCE?
If not a bug, is there any workaround?
Thanks.
StretchableLayoutManagerBugSample.zip (4.0 KB)