# Detecting key-down with click event

**URL:** <https://forum.inductiveautomation.com/t/detecting-key-down-with-click-event/20681>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [November 8, 2018, 7:54pm UTC](https://forum.inductiveautomation.com/t/detecting-key-down-with-click-event/20681 "2018-11-08T19:54:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zacslade](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacslade/32/3587_2.png) [@zacslade](https://forum.inductiveautomation.com/u/zacslade)\
**Post date:** [November 8, 2018, 7:54pm UTC](https://forum.inductiveautomation.com/t/detecting-key-down-with-click-event/20681/1 "2018-11-08T19:54:13Z")

</div>

Hi all,

I’m building a sort of custom menu using the template repeater, and I want to be able to shift-click and ctrl-click the menu items for multiple selection. The logic behind selecting isn’t a problem, but I don’t know how to detect whether a key is down at the time of the mouse-click event.

Anybody know how to do that?

Thanks,

---

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [November 8, 2018, 8:10pm UTC](https://forum.inductiveautomation.com/t/detecting-key-down-with-click-event/20681/2 "2018-11-08T20:10:03Z")

</div>

Use event.getModifiers()

```auto
from java.awt.event import InputEvent

modifiers = event.getModifiers()

print "Shift down: ", (modifiers & InputEvent.SHIFT_MASK) == InputEvent.SHIFT_MASK
print "Ctrl down: ", (modifiers & InputEvent.CTRL_MASK) == InputEvent.CTRL_MASK

```
