[squeak-dev] Cursor position finding

tim Rowledge tim at rowledge.org
Tue Aug 12 20:57:03 UTC 2014


On 12-08-2014, at 12:28 PM, Bert Freudenberg <bert at freudenbergs.de> wrote:
>> Surely we have a non-destructive way of finding current state on the cursor position, modifier state etc somewhere in there?
> 
> Try
> 
> 	self currentEvent shiftPressed
> 
> or
> 
> 	self currentEvent position

Excellent; these are definitely making it work much better.

It seems odd that all UserInputEvents understand shiftPressed but not anyButtonPressed. It’s easy enough to put a null method up there so it doesn’t dNU:, but does it make sense to actually pay attention to the buttons value for key events?

Another irritating idiom from the old days is exemplified in this code -
	Cursor eyeDropper showWhile: [
		Sensor waitButton.
		[Sensor anyButtonPressed] whileTrue: [
			self color: (Display colorAt: Sensor cursorPoint).
			w displayWorldSafely]].

What’s our least awful way of handling this? I guess I should point out that it’s in a mouseUp: method and probably needs to be completely restructured.

Modernising old code is *such* fun….

tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Strange OpCodes: EROS: Erase Read-Only Storage




More information about the Squeak-dev mailing list