Button tracking Morph

subbukk subbukk at gmail.com
Thu May 24 14:34:23 UTC 2007


Hi,

Is there a way to get notified (not polling) when any mouse button/modifier 
key goes up/down?

I was trying to put together a Morph (like the Mouse button indicator in the 
Orange Book) that tracks up/down status of mouse buttons and modifier keys in 
real time. I got stuck because all existing usage of Sensor is based on 
polling while I would rather get notified on changes.

I tried stepping the following code every 175 ms:

	self color: Color lightGray.
	#(red yellow blue) do: [ :c |
		(Sensor perform: (c , 'Pressed') asSymbol) ifTrue: [
			self color: (Color perform: c) ]
	].

There must be better way,
TIA .. Subbu




More information about the Squeak-dev mailing list