Close sub-window by clicking anywhere inside a main window

I tried doing this by adding a click listener to the main UI class…The subwindow closes if i don’t click outside the components in the main window… but if i click on the component eg. a button in my main window… the subwindow does not close.

i want a popover type of behaviour.

Any better wat to do this??

Hi,

You can use the blurlistener in the Window:

[code]
final Window myWindow = new Window(“My Window”);
myWindow.setContent(new VerticalLayout()
{
{
addComponent(new Label(“My Label”)
{
{
focus();
}
});
}
});

                myWindow.addBlurListener(new FieldEvents.BlurListener()
                    {
                        @Override
                        public void blur(FieldEvents.BlurEvent event)
                        {
                            myUI.removeWindow(myWindow);
                        }
                    });

                myUI.addWindow(myWindow);

[/code]Codes above worked fine for me.

with this solution the window closes even if the focus is set to a textbox inside the modal window