|
Morphic event-handling confusion: msg#00095lang.smalltalk.squeak.beginners
I'm trying to use Morphic, in Squeak 3.9, to make a very simple "physics model" I call a HockeyPuck. The idea is that it's a CircleMorph subclass that one should be able to pick up with the Hand and "throw", and have it bounce off the World edge (and then, hopefully, other such Pucks). I've got the "step" animation thing figured out pretty well, and I have some idea how to compute the motion and bounces and such, but I'm stumped as to how to properly handle the mouse events. On Eddie Cottongim's suggestion, at http://wiki.squeak.org/squeak/2477 , I tried using "self on: #startDrag send: #beginThrow to: self" (in my initialize method) but that seems a little weird, and doesn't seem to allow the default dragging behavior to go through. I also tried the approach of overriding handlesMouseDown and mouseDown, and sending "super mouseDown" in the latter, but that doesn't seem to work any better, although it makes a little more sense to me. There's a two-step sequence of messages I'd like my Puck to receive while still doing the normal getting-moved-by-the-Hand stuff. The first is #beginThrow, to be sent either on a mouseDown or (preferably) on a startDrag event. The second is #endThrow, to be sent on the subsequent mouseUp. How can I make this happen? Thank you very much for your time.
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Storing a negative SmallInterger in a ByteArray, Lukas Renggli |
|---|---|
| Next by Date: | Re: Populate a new array., Michael van der Gulik |
| Previous by Thread: | Accessors, Blake |
| Next by Thread: | Re: Morphic event-handling confusion, Michael van der Gulik |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |