First time here? Check out the FAQ!
x

In a Tool is there a way of telling when a key is pressed?

0 votes
297 views

I've seen a few examples in Tools of using LastCharacterTyped but is there a way of detecting when a (computer keyboard) key is down? For instance if I want to use a key press as a gate rather than just a trigger I want to detect the key down and possibly key up events. 

I saw in another Q&A answer mention of "KymaWindowSensor shiftDown" to detect the state of the shift key. Is there a similar expression for detecting other keys?

asked Jul 29, 2019 in Capytalk & Smalltalk by alan-jackson (Virtuoso) (15,840 points)

1 Answer

0 votes
Unfortunately, Smalltalk tracks the up/down state of only the Control, Shift, Command, and Caps Lock keys and none of the other keys.
answered Jul 29, 2019 by ssc (Savant) (127,080 points)
That's a shame. I can't poll either can I, unless there's a "no current key press" state.
...