[Q] Making a button immune to mouse clicks

Ned Konz ned at bike-nomad.com
Sun Apr 14 20:22:19 UTC 2002


On Sunday 14 April 2002 11:22 am, Martin Drautzburg wrote:
> If an area is covered by a morph and a sumborph which one will
> receive the mouse events ?

Safer than playing with mouseDownPriority (which I found to be very 
tricky) is to just lock the submorphs and then you'll get the events 
in the parent. You can then explicitly call the submorphs mouseDown: 
etc. methods.

for extra credit: study this message trace to understand what happens 
when you click on a Morph:

m _ Morph new.
sm _ Morph new extent: 20 at 20; color: Color red.
sm center: m center.
m addMorph: sm.
m openInWorld.
evt _ MouseButtonEvent new 
		setType: #mouseDown
		position: sm center
		which: 0
		buttons: 0
		hand: ActiveHand
		stamp: Time millisecondClockValue.
evt toggleRedButton.
MessageTally tallySends: [ ActiveHand handleEvent: evt ].

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




More information about the Squeak-dev mailing list