View Full Version : Listen events from a non child Window

12 Apr 2011, 4:04 AM

This is the situation. I have a class that extends layoutContainer with some buttons which open a different "popUp" Window when clicked. Those Windows, when closed, should reload data in a grid added in the layoutcontainer. Id like to listen to a custom event fired by the popUps when needed, but as Window is not attached to the layoutContainer (its just created and showed) and the method to reload data into grid is on the layoutContainer, adding a listener to that event on the LayoutContainer doesnt work (because events have to be fired by itself or its children, right?).
The solution of adding a listener directly to the popUp to that specific event (coding that from LayoutContainer) is not possible because those popUps are not always created in the Layoutcontainer (sometimes theyre are created from another popUp).

The workaround Ive found is to pass a reference to the LayoutContainer in the popUps constructor and change visibility of reloadData method to public, but Id prefer a more sophisticated method to achieve that result.