Skip navigation
Dan Rodney 46 posts
Jan 18, 2010
Currently Being Moderated

[JS] Script UI Second Window Problem

Sep 2, 2012 6:58 PM

Tags: #cs5 #cs5.5 #javascript #indesign #scripting #extendscript #cs6 #dialog #dialogs #scriptui

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();
 
 
Replies
  • Currently Being Moderated
    Sep 2, 2012 9:21 PM   in reply to Dan Rodney

    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();
    
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points