2 Replies Latest reply on Mar 9, 2016 2:01 AM by tssee@imgof.com

    close second panel

    Level 1

      Thanks this forum I learned a lot in recent times

      Now I have this little problem that I can not rosolvere:

      I created a panel that opens another panel

      The problem is that if I want to close the second panel with the close button that does not close

      to close the second panel I must click the x  at the top sx mac

      how can I do to close the panel by clicking directly on close?

       

      /////////////////panel  1

      var win = new Window("palette", "PANEL 1");

       

       

      win.cancelOk = win.add('panel', [10,495,300,540], "");

         win.cancelOk.buildBtn = win.cancelOk.add('button', [10,10,180,35], 'OPEN PANEL 2', {name:'ok'});

       

         win.closeButton = win.cancelOk.add("button",  [190,10,280,35], "CLOSE");

       

       

       

       

      ////////////////////////////////////////////start panel 2//////////////////////////////////////////

         win.cancelOk.buildBtn.onClick = function () {

       

      var win = new Window("palette", "PANEL 2");

       

      win.cancel2Ok = win.add('panel', [10,495,300,540], "");

         //win.cancelOk.buildBtn = win.cancelOk.add('button', [10,10,180,35], 'OPEN PANEL 2', {name:'ok'});

       

         win.closeButton = win.cancel2Ok.add("button",  [10,10,280,35], "CLOSE");

       

      win.onDeactivate = function(){

         win.update();

         };

       

      var closeWin = false;

       

      win.closeButton.onClick = function(){

         closeWin = true;

         w.close();

          };

       

      win.onClose = function(){

         closeWin = true;

          };

       

       

      win.show();

       

      while(closeWin == false){

         app.refresh();

          }; 

        }

        ////////////////////////////////////////////finish panel 2//////////////////////////////////////////

         

       

       

       

      //////////////finisch panel 1

       

       

      win.onDeactivate = function(){

         win.update();

         };

       

      var closeWin = false;

       

      win.closeButton.onClick = function(){

         closeWin = true;

         w.close();

          };

       

      win.onClose = function(){

         closeWin = true;

          };

       

      win.show();

       

      while(closeWin == false){

         app.refresh();

          };