StretchableLayoutManager and StretchableLayoutResizerBar


#1

Hi,

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:

[code]MainComponent()
: 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();
	addAndMakeVisible(comp1);

	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);
}[/code]

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

[code]Component1::Component1()
: Component( T(“component1”) )
{
addAndMakeVisible(boldButton = new ToggleButton (T(“bold”)));
boldButton->setBounds(10,10,60,30);

addAndMakeVisible(itaButton = new ToggleButton (T("ita")));
itaButton->setBounds(100,100,60,30);

}[/code]

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

Leskimo


#2

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.

Leskimo


#3

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.


#4

Hi,

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

Leskimo


#5