javascript - Photoshop ScriptUI: Show a dialog window, close it, show it again gives an empty full size window -
in script photoshop cc 2015 (windows 10), written in javascript, processing layers of active document in loop , want show setup dialog in each step.
for simplification, take following working example. window defined outside loop, , among other steps stripped here, window shown once every step in loop:
#target photoshop var w = new window('dialog', 'title'); var b = w.add('button', undefined, 'ok'); (var = 0; < 3; i++) { // other code w.show(); // other code }
when execute it, small dialog window 1 "ok" button appears, expected. can close using "ok" button. but every consecutive w.show()
produces blank window fills entire screen, no controls whatsoever. can closed using esc key.
i tried overriding b.onclick
event , manually call close()
, did not change anything.
upon inspection of w
variable, obvious bounds
, respectively location
, size
somehow got changed. tried resetting these values previous state, , window size restored. however, button still not visible.
am missing something? how can dialog window show correctly more once?
try code, works me photoshop cc + osx.
w.close()
destroy dialog window, should create again.
press button named 'ok', press return key same w.close()
.
#target 'photoshop' (var = 0; < 3; i++) { var w = w(); $.writeln(w.show()); } function w () { var w = new window('dialog', 'title'); var b = w.add('button', undefined, 'ok', {name:'ok'}); return w }
Comments
Post a Comment