First time here? Check out the FAQ!
x

Can a tool monitor the state of a keyboard Shift (or Ctrl or Alt / Option or Command) key?

+1 vote
254 views

Question du jour:

I think the question title says it all.  In looking at sources like Squeak, I see "Sensor is an instance of EventSensor" and that it allows for things like "Sensor leftShiftDown".  Can I create a trigger within a Tool for Sensor leftShiftDown hasChanged or similar?

asked Jun 19, 2015 in Capytalk & Smalltalk by kevin-cole (Adept) (1,050 points)

1 Answer

0 votes

There's a special Global variable you can use in the Tool called LastCharacterTyped.  If you declare that as an Object and set its initial value to $a, then you can make decisions based on whichever character is typed on the computer keyboard by testing for equality to that character.

To detect whether the shift key is down, you can use:

KymaWindowSensor shiftDown

To detect whether the mouse is down you can use:

KymaWindowSensor mouseDown

Can you use these to get the triggers you need?

answered Jun 20, 2015 by ssc (Savant) (127,060 points)
...