How to detect shift down

Ross Boylan RossBoylan at stanfordalumni.org
Wed Apr 24 01:13:32 UTC 2002


On Tue, Apr 23, 2002 at 08:06:16PM +0200, Andreas Raab wrote:
> Try
> 
> 	ActiveEvent shiftPressed.
> 
> Cheers,
>   - Andreas
That still doesn't seem to work.  The code I put this in (before a
halt) never halted, though I sat on the shift key.  When I test in a
workspace
(Delay forSeconds: 1) wait. ActiveEvent anyModifierKeyPressed 
is always true, but shiftPressed is always false.  One possible
explanation is that the relevant event is the one causing the
evaluation (alt-p).  But at any rate I still can't get a hold of the
current keyboard state.

> 
> > From: squeak-dev-admin at lists.squeakfoundation.org 
> > [mailto:squeak-dev-admin at lists.squeakfoundation.org] On 
> > Behalf Of Ross Boylan
> > Sent: Tuesday, April 23, 2002 8:01 PM
> > To: squeak-dev at lists.squeakfoundation.org
> > Cc: Ross Boylan
> > Subject: Q: How to detect shift down
> > 
> > 
> > I am in a morphic project trying to detect if the shift key is
> > pressed.
> > I have tried a bunch of things like
> > Sensor shiftPressed
> > InputSensor default anyModifierKeyPressed (with ctl, since comment
> > says it ignores shift)
> > 
> > but it always returns false.
> > 
> > What's the trick?
> > 
> > By the way, I'm just doing this so I can say
> > Sensor leftShiftDown ifTrue: [self halt]
> > so that the halt doesn't stick me in a loop.
> > 
> 
> 



More information about the Squeak-dev mailing list