events in morphic

Michael Rueger m.rueger at acm.org
Mon Jun 26 16:09:25 UTC 2000



cole at griffoninc.com wrote:
> 
> Thanks Bert and Michael for your responses. Unfortunately the
> doubleClick example morph has exactly the problem I've experienced. The
> morph responds correctly to the doubleClick event but will no longer
> allow itself to be dragged. When I take out the methods allowing for the
> doubleClick processing the morph can be dragged and acts correctly.

Oh, now I got ya!
This is a general problem with the way Morphic handles events.
In HandMorph>>handleMouseDown: the morph can only be dragged if it does
not handle mouse down events.

If you want a morph to be draggable (and not start a drag of something)
insert 
	evt hand grabMorph: self
into the startDrag: method.

DoubleClickExample
startDrag: evt
	| oldCenter |
	"We'll get a mouseDown first, some mouseMoves, and a mouseUp event
last"
	self showBalloon: 'drag (mouse down)'.
	self world displayWorld.
	(self containsPoint: evt cursorPoint)
		ifFalse: [^ self].

	oldCenter _ self center.
	color = Color red
		ifTrue:
			[self extent: self extent + (1 at 1)]
		ifFalse:
			[self extent: ((self extent - (1 at 1)) max: (16 at 16))].
	self center: oldCenter.
	evt hand grabMorph: self


Michael

-- 
 "To improve is to change, to be perfect is to change often." 
                                            Winston Churchill
+------------------------------------------------------------+
| Michael Rueger    m.rueger at acm.org      ++1 (310) 937 7196 |
+------------------------------------------------------------+





More information about the Squeak-dev mailing list