How to detect shift down

Ned Konz ned at bike-nomad.com
Wed Apr 24 05:35:19 UTC 2002


On Tuesday 23 April 2002 06:13 pm, Ross Boylan wrote:
> 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.

You can't wait in the UI and still expect to get events. That is, 
during the delay no events will get processed, and you will then test 
the event that was active prior to the doit or printit.

However, if you test this in your step method it should be OK. Just 
don't hang the UI by delaying.

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE




More information about the Squeak-dev mailing list