[ScriptUI] ALT keydown listener on the Window object
Hi,
I've a half baked demo dialog:
var res = """dialog {
orientation: 'column',
okButton: Button { text: 'OK' },
cancelButton: Button { text: 'Cancel' },
resetButton: Button { text: 'Reset the Cancel button'}
}""";
var win = new Window(res);
win.resetButton.addEventListener('click', function(evt){
win.cancelButton.text = 'Cancel';
})
win.addEventListener('keydown', function(evt) {
if(true /* SUBSTITUTE HERE WORKING CONDITIONAL */) {
win.cancelButton.text = "Reset";
}
});
win.show()
Which looks like that:

I'd like to listen, in the main Window, to the ALT keydown, so that the Cancel button text turns into "Reset", as it is with Adobe's dialogs.
Problems:
- the keypress is forbidden in PS (beeps – while it is actually listened in ESTK)
- I can't find the right conditional to stick in the if)
Apparently ALT, as well as other modifier keys, works (at least in ESTK) only in conjunction with other keys, e.g. I can detect ALT+something (say ALT+A), but not ALT alone.
So, are these two problems unavoidable? Is it possible to listen to keydown in Dialog Windows in Photoshop? Can I listen to a modifier key only? I can probably listen for the modifier key in the button's click handler, but I'd like to have a visual feedback as well.
Thank you in advance!
Davide