Why does Photoshop CC 2015 scripting scriptUI addEventListener keydown not work?

  • 1
  • Question
  • Updated 2 years ago
This Mike Hale script works prior to CC 2015

function NumericEditKeyboardHandler (event) {
try {
var keyIsOK = KeyIsNumeric (event) ||
KeyIsDelete (event) ||
KeyIsLRArrow (event) ||
KeyIsTabEnterEscape (event);

if (! keyIsOK) {
// Bad input: tell ScriptUI not to accept the keydown event
event.preventDefault();
/* Notify user of invalid input: make sure NOT
to put up an alert dialog or do anything which
requires user interaction, because that
interferes with preventing the 'default'
action for the keydown event */
app.beep();
}
}
catch (e) {
; // alert ("Ack! bug in NumericEditKeyboardHandler: " + e);
}
}
// key identifier functions
function KeyIsNumeric ( event ) {
return ( event.keyName >= '0' ) && ( event.keyName < 0 || Number(this.text) > 100 ){
alert('Out of range');
// handle however you like
this.text = '';
}
}
w.btnPnl.okBtn.onClick = function ( ) { this.parent.parent.close( 1 ); alert("OK"); };
w.btnPnl.cancelBtn.onClick = function ( ) { this.parent.parent.close( 2 ); alert("Cancel");};
};
runDialog = function( w ) {
return w.show( );
};
var win = createDialog();
initializeDialog( win );
runDialog( win );
Photo of John McAssey

John McAssey

  • 199 Posts
  • 28 Reply Likes

Posted 3 years ago

  • 1
Photo of Eric Ching

Eric Ching, Employee

  • 87 Posts
  • 48 Reply Likes
Hi John,

This should be fixed.  Can you please retest in Photoshop CC 2015.5.1?

Thanks,
Eric