3 Replies Latest reply on Jun 4, 2008 1:41 PM by lollerskatebuttes

    Quit Bug / Issue on OS X (10.4 and 10.5)

    lollerskatebuttes Level 1
      I have a javascript / HTML application that uses a chromeless window (this may or may not be related to the issue) and everything works great except for one thing: If I hit Command-Q to quit the app, nothing happens except a system alert sound.

      If I go to the menu bar and choose [ App Name ] -> Quit, nothing happens the first time, but it will quit the second time if that menu option is chosen. If i choose that option once (and it fails) ad then hit Command-Q, the app quits as well.

      I have a button in the application window itself that quits, and clicking that quits the app as expected every time. Here is the relevant code:

      Code to handle window closing / quit event:
      quote:


      window.nativeWindow.addEventListener(air.Event.CLOSING, this.windowClosingHandler);



      Function that handles said event:
      quote:


      this.windowClosingHandler = function(event){
      event.preventDefault();
      nativeWindow.removeEventListener("closing", self.windowClosingHandler);
      self.writePreferenceFile();
      air.NativeApplication.nativeApplication.exit();
      }






      Here is my close button code, which as mentioned, functions as expected every time:
      quote:


      this.closeButton.click(function(e){
      var doClose = new air.Event(air.Event.CLOSING, true, true);
      window.nativeWindow.dispatchEvent(doClose);
      });



      Is there another event handler I should be watching for Command-Q / the menu for it to work, or is my code not doing something it should be?


      (Also, no CODE tag??? )