[Q] doubleclickable and dragable morph: how?

tblanchard at mac.com tblanchard at mac.com
Wed Apr 30 19:29:00 UTC 2003

I would consider the handleXXX methods to be private.  In fact, I tried 
to move them out of Brick (and failed - but I may try it again soon).  
These methods do more than just let you add a hilight to your morph 
when the mouse goes down on it.  They also do the event forwarding to 
models/delegates.  So I think you should not override them as I 
consider them to be part of the system level event dispatching 

Example from morph:

handleMouseDown: anEvent
	"System level event handling."
	anEvent wasHandled ifTrue:[^self]. "not interested"
	anEvent hand removePendingBalloonFor: self.
	anEvent hand removePendingHaloFor: self.
	anEvent wasHandled: true.
	anEvent controlKeyPressed ifTrue:[^self invokeMetaMenu: anEvent].
	"Make me modal during mouse transitions"
	anEvent hand newMouseFocus: self event: anEvent.
	anEvent blueButtonChanged ifTrue:[^self blueButtonDown: anEvent].
	(self allowsGestureStart: anEvent)
		ifTrue: [^ self gestureStart: anEvent].
	self mouseDown: anEvent.
	anEvent hand removeHaloFromClick: anEvent on: self.
	(self handlesMouseStillDown: anEvent) ifTrue:[
		self startStepping: #handleMouseStillDown:
			at: Time millisecondClockValue + self mouseStillDownThreshold
			arguments: {anEvent copy resetHandlerFields}
			stepTime: 1].

Notice that if you just override this method without calling super, 
balloons will stay open, menus will stop working, and mouseStillDown 
tracking won't work.  Instead you want to implement mouseDown: to add 
your behavior.

On Wednesday, April 30, 2003, at 12:05  PM, Rudi Angela wrote:

> I have a Morph subclass, which is dragable by default. Now I would 
> also like to make it doubleclickable. But if I start adding the 
> methods #handlesMouseDown, etc, then apparently I loose the 
> dragability. Am I doing something wrong? Or does Morphic not support 
> this combination of behaviors?
> Rudi Angela
> __________________________________________________________________
> Try AOL and get 1045 hours FREE for 45 days!
> http://free.aol.com/tryaolfree/index.adp?375380
> Get AOL Instant Messenger 5.1 for FREE! Download Now!
> http://aim.aol.com/aimnew/Aim/register.adp?promo=380455

More information about the Squeak-dev mailing list