[Newbies] Morphic event-handling confusion

Michael van der Gulik mikevdg at gulik.co.nz
Sat Mar 17 04:45:07 UTC 2007


Max OrHai wrote:

>  
>
>>handlesMouseStillDown: evt
>>    ^ true
>>
>>mouseStillDown: evt
>>    self position: evt hand position.
>>    
>>
>
>These apparently don't do anything. But, that's OK, because I can, as
>Bert suggested, just send "evt hand #grabMorph: self".
>
>Except, oops, that's NOT OK, because now mouseUp: apparently never gets
>sent to my Morph.
>
>So, I still need help. Thank you both very much.
>  
>
They "worked for me" - I was dragging a Morph around, and had readouts 
for the start and end positions of the dragging. Try making a completely 
fresh subclass of Morph with only the methods I suggested. I used Squeak 
3.9.

If I was going to implement momentum, I'd take the current position on 
mouseUp: and the position received by the very latest mouseStillDown:, 
and work out which vector the puck should travel in from that. I suppose 
you'd also need the times of those two events as well to calculate the 
velocity vector.

Michael.


More information about the Beginners mailing list