单击ScriptUI按钮时如何检测降档? [英] How to detect shift down when clicking on ScriptUI button?

查看:112
本文介绍了单击ScriptUI按钮时如何检测降档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的scriptUI面板上,有一个按钮。单击按钮时如何检测用户是否按住 shift 键?

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?

推荐答案

您可以在按钮上添加一个事件监听器。

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

这篇关于单击ScriptUI按钮时如何检测降档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆