2 Replies Latest reply on Sep 2, 2012 9:31 PM by Dan Rodney

    [JS] Script UI Second Window Problem

    Dan Rodney Adobe Community Professional

      The code below seems to work at first, but at a closer look there's a problem (and I can't figure out how to fix it). Here's what's happening:

       

      1. Run the script and it will display a dialog (as I'd expect).
      2. In that dialog click the button to display a second dialog (as I'd expect).
      3. Click OK (or Cancel) in the second dialog.
      4. Now that you're back in the main dailog, once again click the button to display the second dialog. This time the second dialog will display collapsed and you can't see anything inside it. It displays right the "first" time, but not the "second" time.

       

      Any thoughts? Thanks in advance,

      Dan

       

      #targetengine 'session'
      
      var myWin = new Window("dialog", 'Window 1' );
                someText = myWin.add( "edittext", undefined, 'Some text here' );
                var clickMeButton = myWin.add( "button", undefined, 'Click Me to Open a Window' );
                var okButton = myWin.add( "button", undefined, 'OK' );
                var cancelButton = myWin.add( "button", undefined, 'Cancel' );
      
      var mySecondWin = new Window("dialog", 'Window 2' );
                someText2 = mySecondWin.add( "edittext", undefined, 'Some text here2' );
                var okButton2 = mySecondWin.add( "button", undefined, 'OK' );
                var cancelButton2 = mySecondWin.add( "button", undefined, 'Cancel' );
      
      clickMeButton.onClick = function() {
                mySecondWin.center();
                mySecondWin.show();
      }
      
      myWin.center();
      myWin.show();
      
      
        • 1. Re: [JS] Script UI Second Window Problem
          CarlosCanto Adobe Community Professional & MVP

          one way....

           

          #targetengine 'session'
          
          var myWin = new Window("dialog", 'Window 1' );
                    someText = myWin.add( "edittext", undefined, 'Some text here' );
                    var clickMeButton = myWin.add( "button", undefined, 'Click Me to Open a Window' );
                    var okButton = myWin.add( "button", undefined, 'OK' );
                    var cancelButton = myWin.add( "button", undefined, 'Cancel' );
          
          clickMeButton.onClick = function() {
                              var mySecondWin = new Window("dialog", 'Window 2' );
                              someText2 = mySecondWin.add( "edittext", undefined, 'Some text here2' );
                              var okButton2 = mySecondWin.add( "button", undefined, 'OK' );
                              var cancelButton2 = mySecondWin.add( "button", undefined, 'Cancel' );
          
                    mySecondWin.center();
                    mySecondWin.show();
          }
          
          myWin.center();
          myWin.show();
          
          • 2. Re: [JS] Script UI Second Window Problem
            Dan Rodney Adobe Community Professional

            Well that was easy! Thank you soooo much.