CloseEvent behavior...

View: New views
2 Messages — Rating Filter:   Alert me  

CloseEvent behavior...

by pk109400 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I've just started working with Rialto-GWT and I really like the
library. A quick newbie question - How can I change the default
behavior of the close button on a SimpleWindow?  I have a deck of
three SimpleWindows overlaid on top of each other with
setOverOpenWindow(true).  I'd like to setClosable(true) but also for
the closeEvent to not actually close the window, but just
setEnable(false)- so I want to override the behavior of the close
icon.  What JSNI functions in which classes do I need to override?

Thank you, and great job on this library!

Pallavi


Re: CloseEvent behavior...

by Gilles Rossi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

Changing the behavior of the close button is a little bit tricky in the current version. To do that, you need to:

1) create the following JSNI method:
private native static void redefineClose(JavaScriptObject jso)/*-{
        jso.btnClose.onclick = function () {
                 // your code here
        };
}-*/;

2) override the initProperties() method of your SimpleWindow like (with an anonymous class):

SimpleWindow sp1 = new SimpleWindow("My simple window") {
        @Override
        protected void doInitProperties() {
                super.doInitProperties();
                redefineClose(getJsObject());
        }
};

Gilles

--- In rialto-dev@..., "pk109400" <pallavikaushik@...> wrote:

>
> Hello,
>
> I've just started working with Rialto-GWT and I really like the
> library. A quick newbie question - How can I change the default
> behavior of the close button on a SimpleWindow?  I have a deck of
> three SimpleWindows overlaid on top of each other with
> setOverOpenWindow(true).  I'd like to setClosable(true) but also for
> the closeEvent to not actually close the window, but just
> setEnable(false)- so I want to override the behavior of the close
> icon.  What JSNI functions in which classes do I need to override?
>
> Thank you, and great job on this library!
>
> Pallavi
>