-
1 Jun 2008 1:00 PM #1
Widget did not show up - doing inside event.
Widget did not show up - doing inside event.
Hi,
I'm trying to adding/removing widget from LayoutContainer when user clicks a button, but after removing old widgets and adding a new one, it won't show up, seems like it wasn't rendered, hm..
However, if those code is outside the event, it works as expected.public void onModuleLoad() {
final Viewport viewport = new Viewport();
final LayoutContainer content = new LayoutContainer();
Button bbb = new Button("bbb");
bbb.addListener(Events.OnClick, new Listener<ComponentEvent> () {
public void handleEvent(ComponentEvent ce) {
content.removeAll();
Button ccc = new Button("ccc");
content.add(ccc);
// I expected to see the ccc button, but see a blank page instead.
}
});
content.add(bbb);
viewport.add(content);
RootPanel.get().add(viewport);
}
extgwt - beta3
gwt-1.5rc1
Thank you
-
1 Jun 2008 1:11 PM #2
Ok, two things...
1) call content.layout() in the selection event and it should showup. The reason is that before render there is no need to call layout. After render (in the event queue) you need to call layout to get things rendered again.
2) you really should be using GWT1.5 M2 as RC1 is not supported - certain things don't work. A version supporting RC1 is scheduled in the next few days.
-
1 Jun 2008 8:37 PM #3
Thank you ! .layout(true) does the job, I've been fighting with this for 2 days.!


Reply With Quote