What the HandMorph does in terms of event handling: event dispatching (colorfully described)
Eddie Cottongim writes: I know of three main ways to handle events in Morphic.
1. The first, and most common/best AFAIK, is to use the pattern:
on: eventName send: selector to: recipient
As in:
myMorph on: #mouseDown send: #clicked to: self.
A list of recognized eventNames is in EventHandler on:send:to:. I went ahead and copied them.
#mouseDown
#mouseMove
#mouseStillDown
#mouseUp
#mouseEnter
#mouseLeave
#mouseEnterDragging
#mouseLeaveDragging
#click
#doubleClick
#startDrag
#keyStroke
This is flexible, and allows you to send events to arbitrary objects. You don't have to subclass the Morph. There are also other variations like on:send:to:withValue:.
3. The third way is to create your own EventHandler, and install it with Morph #eventHandler:. I haven't done this myself, but it might be useful if you need to apply many custom behaviors to many different morphs. Morphs can share EventHandlers, btw.
You may need to inspect an event. (What key was pressed, what mouse button was clicked)?