How to detect shift down when clicking on ScriptUI button?

两盒软妹~` 提交于 2019-12-21 05:33:48

问题


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?


回答1:


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 ();


来源:https://stackoverflow.com/questions/16446076/how-to-detect-shift-down-when-clicking-on-scriptui-button

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!