Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect shift down when clicking on ScriptUI button?

On my scriptUI panel, I have a button. How can I detect whether the user is holding the shift key when they click on the button?

like image 304
bgmCoder Avatar asked Dec 04 '25 18:12

bgmCoder


1 Answers

You can add an eventListener to your button.

var win = new Window ("dialog");
win.aButton = win.add ("button", undefined, "Button");
win.aButton.addEventListener ("click", function (k) {
      if (k.shiftKey) {
        alert("foo");
      }else{
        alert("bah");
      }
  });
win.show ();
like image 145
fabianmoronzirfas Avatar answered Dec 06 '25 14:12

fabianmoronzirfas