Detecting key-down with click event

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?


Use event.getModifiers()

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