Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Scripting
Viewing all articles
Browse latest Browse all 12244

Modeless window using "palette" does not stay up in CS5

$
0
0

I am having trouble running a modeless dialog with CS5 (on Windows 64-bit).  My own script does not stay up and neither does the SnpCreateDialog.jsx snippet that  comes with the ESTK and is supposed to demonstrate modeless dialogs.  I have  tried:

 

  1. Running from the Scripts panel
  2. Add #target photoshop
  3. Being sure the drop-down menu says Photoshop, not CTSK

 

as suggested in an older discussion at http://forums.adobe.com/message/3008230#3008230.  (I decided to make a new discussion as that one was marked answered.)

 

It also does not stay up when moved into the Photoshop Scripts folder and run from the File menu in Photoshop.

 

The relevant code in SnpCreateDialog.jsx is:

 

function SnpCreateDialog()
{     this.windowRef = null;
}

/**
 Functional part of this snippet.

 Create a window of type "palette" (a modeless dialog) and display it.

 @return True if the snippet ran as expected, false otherwise.
 @type Boolean
*/
SnpCreateDialog.prototype.run = function()
{
     // Create a window of type palette.     var win = new Window("palette", "SnpCreateDialog",[100,100,380,245]);  // bounds = [left, top, right, bottom]     this.windowRef = win;     // Add a frame for the contents.     win.btnPanel = win.add("panel", [25,15,255,130], "SnpCreateDialog");     // Add the components, two buttons     win.btnPanel.okBtn = win.btnPanel.add("button", [15,65,105,85], "OK");     win.btnPanel.cancelBtn = win.btnPanel.add("button", [120, 65, 210, 85], "Cancel");     // Register event listeners that define the button behavior     win.btnPanel.okBtn.onClick = function() {          $.writeln("OK pressed");          win.close();     };     win.btnPanel.cancelBtn.onClick = function() {          $.writeln("Cancel pressed");          win.close();     };     // Display the window     win.show();              return true;         
}

/**
 "main program": construct an anonymous instance and run it
  as long as we are not unit-testing this snippet.
*/
if(typeof(SnpCreateDialog_unitTest) == "undefined") {    new SnpCreateDialog().run();
}

 

If  I put a breakpoint on the "return true;" line, then I can see that the dialog has, in fact, been created and is visible, but it has returned from win.show() and will go away as soon as the script continues.

 

Any help would be appreciated.


Viewing all articles
Browse latest Browse all 12244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>