Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Window - Cancel close event

    Hello folks,

    How do i cancel the close event of a window ? Doing something like this:

    Code:
    ...
    myWindow.addCloseClickHandler(new CloseClickHandler() {
    	@Override
    	public void onCloseClick(CloseClickEvent event) {
    		SC.confirm("Confirm close?", new BooleanCallback() {
    			
    			@Override
    			public void execute(Boolean value) {
    				if(value){
    					//close window
    				}else{
    					//do not close
    				}
    			}
    		});
    	}
    });
    ...
    Thanks by the attention!

    #2
    Has this ever been addressed or resolved? event.cancel() doesn't seem to do anything in GWT 2.6, SGWT 5.0p.

    Comment


      #3
      I come across the same issue.

      The window close immediately after close button click.

      The dialog SC.ask or SC.confirm is shown after the window closed.

      It used to work at GWT5.0, but doesn't work in the night build. Is it a bug?

      Comment


        #4
        SC.ask()/confirm() are asynchronous, and it's too late to cancel an event several seconds after event processing has completed. This also never would have worked in a previous version.

        If you have to take an asynchronous action before you will know whether the window should be closed (including checking with the user, contacting the server, etc), then you should unconditionally cancel closing, then, if indicated, hide() or destroy() the window once the asynchronous action completes.

        Comment

        Working...
        X