PDA

View Full Version : Problem with add component to window after it shown



mr_shlomo
31 Aug 2010, 4:29 AM
Hello

There is a window that contains some components, including, for example, some button to push that out the window to add any other component. In reality it does not appear in the window, why is this happening?

It turns out the components can be added to the window just before the show?

Code:
class SomeWindow extends Window {
public SomeWindow() {
Button b = new Button("press me");
b.addListener(Events.Select, new Listener<ButtonEvent>() {
add(new Button("Another button")); // new button is not shown in the window
});
}
}

BrendanC
31 Aug 2010, 1:28 PM
You need to call the container of the object to render it.


class SomeWindow extends Window {
public SomeWindow() {
Button b = new Button("press me");
b.addListener(Events.Select, new Listener<ButtonEvent>() {
add(new Button("Another button")); // new button is not shown in the window
layout(); //layout calls render
});
}
}

The help center (http://www.sencha.com/helpcenter/index.jsp?topic=/com.extjs.gxt.help/html/reference/layoutcontainer.html) explains the concept in more detail.