Testing for modifiers in Morphic?

Maloney johnm at wdi.disney.com
Fri Feb 26 01:05:56 UTC 1999

>I'd like to have a left-shift-hack in a morph's step method. But it
>doesn't work, at least not like expected:
>When shift is pressed, nothing happens (that is, Sensor shiftPressed
>answers false). If a key or mouse button is pressed while holding shift,
>it flips to true and remains like this even if shift is released. It flips
>back to false only when the next "unshifted" event is received.
>(For testing, I inserted
>	Transcript show: Sensor shiftPressed printString; cr.
>into the morphs step method. Asking the hand for its last event is
>equivalent to this method.)
>What's going on?

The modifier bits only change when a "real" event occurs (at least,
on the Mac). That is, a key or mouse button up or down. Mere mouse
moves don't update the modifer bits.

	-- John

More information about the Squeak-dev mailing list