18 Replies Latest reply on Sep 11, 2013 9:01 AM by Gustavo Del Vechio

    Window of type "palette" and onClose event.

    Gustavo Del Vechio Level 3

      Hi friends

       

      I´m having a trouble with an onClose event in a panel of type "palette". Let´s try to explain the problem.

       

      Suppose I have this single construction:

       

      var myDialog = new Window ("palette", "My dialog", undefined, {closeButton:false});

      var bt = myDialog.add ("button", undefined, "Ok", {name:"ok"});

       

      myDialog.onClose = function(){

      //for example: app.activeDocument.layers.add();

      };

       

      myDialog.show();

       

       

      If I change the window to type "dialog", everything looks preety good, but if I keep the dialog as "palette", then the button "Ok" does not close the dialog and, sure, the onClose does not work.

       

      P.S: I need the onClose event because I want that closing code executed even if the user hit "ESC" instead of using "OK" button.

       

      Any idea how to manage or an alternative to make the button and the onClose works??

       

      Thank you very much

      Best Regards

      Gustavo.