PDA

View Full Version : problem with automatic linebreak



Avaron
28 Nov 2008, 6:59 AM
Hi,

i have a problem with my LayoutContainer LC. In my LC i am placing up to 10 Labels, but atm every Label is placed in one column.

If i am changing my LC to a HorizontalPanel, all my Labels are placed in one row. So far so good.

My Problem is, that when i am giving the Container a fix width (for example 500px), all labels are still put in one row, but i want that my Labels are breaking in a new line if the width would be greater then my specified 500px.

here is an example code

public class App implements EntryPoint {

public void onModuleLoad() {
HorizontalPanel lc = new HorizontalPanel();
lc.setLayout(new FlowLayout());
lc.setWidth(500);
lc.setBorders(true);
lc.setStyleName("labeltest");

Label nr1 = new Label();
nr1.setText("test");
nr1.setSize("50", "30");

Label nr2 = new Label();
nr2.setText("test2222222222222222222222222222222222222222222222222222");
Label nr3 = new Label();
nr3.setText("test3");
Label nr4 = new Label();
nr4.setText("test4");
Label nr5 = new Label();
nr5.setText("test5");

lc.add(nr1);
lc.add(nr2);
lc.add(nr3);
lc.add(nr4);
lc.add(nr5);

RootPanel.get().add(lc);
}
}

in this example i hoped that the labels 3-5 would be in the 2nd row.

I hope you understand my Problem and have a hint for me how i can solve my problem.

Best regards
Avaron


in the premium section darrell posted the solution (http://extjs.com/forum/showthread.php?t=54049)