[DOCS] Mouse button tester

Ned Konz ned at bike-nomad.com
Wed Feb 12 17:29:04 UTC 2003


On Tuesday 11 February 2003 04:31 pm, Hannes Hirzel wrote:
> On the swiki page http://minnow.cc.gatech.edu/squeak/2332
> there is a code snippet for a mouse button tester morph.
>
> It was done by Andreas Raab in March 2002.  It doesn't work anymore
> in 3.4
> Could somebody please send in a fix?
>
>
> m := Morph new.
>  m on: #mouseDown send: #value: to:[:evt|
> 	evt redButtonPressed ifTrue:[m color: Color red].
> 	evt yellowButtonPressed ifTrue:[m color: Color yellow].
> 	evt blueButtonPressed ifTrue:[m color: Color blue]
> ].
> m openInWorld.
>
>
> It works for the red and the yellow button, but for the blue button
> it brings up the halos instead.

I don't think you can do it without subclassing any more, since the 
default assumption in Morph is that blue buttons cause halos to come 
up.

This is perhaps a good example of one part of Morphic that is 
hard-wired and shouldn't be. In effect, this is limiting the user 
interaction to a single tool (the HandMorph) and a single (though 
consistent) interaction style.

However, you can at least view the events including mouse button 
colors using this:

HandMorph showEvents: true

when you're done, do this:

HandMorph showEvents: false

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



More information about the Squeak-dev mailing list