tags:

views:

814

answers:

1

I am using Ext-GWT 2.0.1 and GWT 1.6.4

I have a LayoutContainer that uses a RowLayout. The widgets are added to this container with RowData(1,-1), so that when they change in height, the container also changes height accordingly. I want to do something when this LayoutContainer changes size. How can I add a listener that does this? So far I have tried:

layoutContainer.addListener(Events.Resize, new Listener<ComponentEvent>() {
 public void handleEvent(final ComponentEvent event) {
  //do something
 }
}

But handleEvent never gets called.

+1  A: 

Hi!

I know it's quite old post, but I thought answering may help someone who has just met this problem. So what is wrong in the snippet is the listener type (ComponentEvent). Try with BoxComponentEvent, because LayoutContainer inherits this event from its BoxComponent ancestor. (http://www.jarvana.com/jarvana/view/com/extjs/gxt/2.0.1/gxt-2.0.1-javadoc.jar!/com/extjs/gxt/ui/client/widget/LayoutContainer.html)

code:

layoutContainer.addListener(Events.Resize, new Listener<BoxComponentEvent>(){...}

Hope it helps!

B.R.