Try this: Window.addWindowClosingHandler(new ClosingHandler() { @Override public void onWindowClosing(ClosingEvent closingEvent) { closingEvent.setMessage("Are you sure?"); } });
Have a lot of fun, regards gwtfanb0y On 14 Okt., 11:05, goolie <oskar.ka...@teliasonera.com> wrote: > Hi, > > I'm upgrading my code to the new event structure in gwt 1.6 and I have > a class that was implementing WindowCloseListener, which should now be > replaced by ClosingHandler and CloseHandler instead. My problem is > that I can't get the method onWindowClosing(ClosingEvent event) to be > fired. There is an addCloseHandler method in the Window class to add a > CloseHandler but there is no corresponding method for ClosingHandler. > > What can I do to fire the onWindowClosing(ClosingEvent) method that my > class is implementing?? > I've added code examples below. the first is with the old, deprecated > methods and the second is with handlers instead. > > Regards > Oskar > > This is the old code that worked fine. > public class MyClass implements WindowCloseListener{ > > private MyClass() { > Window.addWindowCloseListener(this); > } > public String onWindowClosing() { > //some code > return "some string"; > } > public void onWindowClosed() { > //some code > } > > This is the new structure where I can't get the onWindowClosing to be > fired. > > public class MyClass implements ClosingHandler, CloseHandler<Window>{ > > private MyClass () { > Window.addCloseHandler(this); > //Here i'd like to add the closingHandler aswell. > } > public void onWindowClosing(ClosingEvent event) { > //some code > event.setMessage("some string"); > } > public void onClose(CloseEvent event) { > //some code > } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en -~----------~----~----~----~------~----~------~--~---