StretchableLayoutManager and StretchableLayoutResizerBar


I’m working on a splitted window which can display some components under the resizer bar. I know how to display some components by inserting them directly in the MainComponent.h file (i started from the tutorial of haydxn), but I’d like to create a subclass of component and display it int the StretchableLayoutManager, but it doesn’t work… D Does somebody know how to display in a Layout a class which contains components?

Her is the code of my MainComponent class constructor:

: Component( T(“Main Component”) )
//verticalLayout.setItemLayout(0, -0.2, -0.8, -0.5);
//verticalLayout.setItemLayout(1, -0.2, -0.8, -0.5);

	//verticalDividerBar = new StretchableLayoutResizerBar (&verticalLayout, 1, true);
    //addAndMakeVisible (verticalDividerBar);
	comp1 = new Component1();

	horizontalLayout.setItemLayout(0, 8, 8, 8);
	horizontalLayout.setItemLayout(1, -0.2, -1.0, -0.5);
	horizontalLayout.setItemLayout (2, 2, 5, 5);

	horizontalDividerBar = new StretchableLayoutResizerBar (&horizontalLayout, 1, false);
    addAndMakeVisible (horizontalDividerBar);

comp1 is the instance of my class Component1, which contains several components. Here is the code of the constructor of Component1:

: Component( T(“component1”) )
addAndMakeVisible(boldButton = new ToggleButton (T(“bold”)));

addAndMakeVisible(itaButton = new ToggleButton (T("ita")));


I hope you get the idea. Thank you for your help!


Hi again,

seems that nobody get the idea…
To simplify, I just want to know how to display a subclass of component, in order to avoid puting all the code in the MainComponent.h file. Fo exampl eI have the same problem when I want to create a Wizard. I want to display another class of component when I press the next button. Sorry if I’m not explicit enough.
Thanks again to anyone who can give me some help.


sorry, I can’t understand what you’re asking or failing to do…

Maybe it’s just that you’ve not positioned the components in your resized() method? Have a close look at the demo code for how this works.


you were right, I forgot the resized method… Thanks a lot