Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Mouse button tester
Last updated at 7:28 pm UTC on 30 June 2017
Open a Workspace and paste the following code snippet into it.
Select all and choose 'do-it'.

 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.
You get a rectangle which changes color according to the mouse button clicked. This may help you setting up the right mouse configuration.

Andreas Raab, March 2002


Unfortunately, this doesn't quite work as intended, since the Morph in question insists on bringing up the halo instead of changing color on a blue button click.

Morph>>blueButtonDown: catches the blue button and brings up a halo first.

If you want to see the events, you can just do this:
    HandMorph showEvents: true

and when you're done you can do this:
    HandMorph showEvents: false


Update June 2017

Squeak 6.0a trunk
[squeak-dev] The Trunk: Morphic-mt.1342.mcz
   Squeak 
Add star 
commits@source.squeak.org
<commits@source.squeak.org>	Fri, Jun 30, 2017 at 9:26 AM
Reply-To: squeak-dev@lists.squeakfoundation.org
To: squeak-dev@lists.squeakfoundation.org, packages@lists.squeakfoundation.org
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1342.mcz

==================== Summary ====================

Name: Morphic-mt.1342
Author: mt
Time: 30 June 2017, 9:26:09.827527 am
UUID: 42b6a5ae-42d0-9849-ac5e-5950b96e6e55
Ancestors: Morphic-nice.1341


 Extract initial invocation of halo or meta menu to event filter at world level. Having this, EventHandler is more reliable 
 and invocation logic is fully captured in PasteUpMorph >> #tryInvokeHalo:. 
 Further halo transfer logic enclosed in SimpleHaloMorph.
This works now:

m := Morph new.
m openInWorld.

m wantsHaloFromClick: false.
m wantsYellowButtonMenu: false.
m wantsMetaMenu: false.

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]].

=============== Diff against Morphic-nice.1341 ===============



See also

SensorReporter
Andrew P. Black on mouse button colors and the command key