How to make a SplitPanel

article removed

The StretchableLayoutManager class does that.
I didn’t look at your code (yet).
Is it possible with your class to add and remove panels dinamically?
I’m currently struggling with the StretchableLayoutManager way of adding components…

[quote=“masshacker”]The StretchableLayoutManager class does that.

Aaah, I see, thanks for the hint! I think by using the StretchableLayoutManager together with a StretchableLayoutResizerBar you can build a splitwindow.
But there seem to be no ready-to-use split component in juce.
My SplitPanel is just a component with 2 child components . If you remove the built-in demo panels, the actual splitting code is very short :

[code]void SplitPanel::setSplitPos( int pos)
float w = getWidth()-border-gap-border;

split = (pos-border-(gap/2)) / w;
if(split < splitmin)
else if(split > splitmax)



[code]void SplitPanel::resized()
int w = getWidth()-border-gap-border;
int h = getHeight()-border-border;

int wa = split*w;
int wb = w-wa;

Component* comp =NULL;
int childcount = getNumChildComponents();
    comp = getChildComponent(0);       
    comp = getChildComponent(1);       


That’s all, this should work with any component pair, the code just looks for the 2 first child components.