Modern integrated System On a Chip (SOC) hardware has many
circuits which are active at the same time. So one kind of event is
sensing something happening in the world. Class EventSensor
handles keyboard key press and mouse hardware interrupts,
translating between hardware signals and software event objects.
Basically, a morph raises its hand and says what events, if
any, it is interested in receiving. Then it implements methods to get
the event objects holding the information of the captured events. In
Cuis-Smalltalk, the class MorphicEvent
and its subclasses represent
the diversity of events in the system.
MorphicEvent
DropEvent
DropFilesEvent
UserInputEvent
KeyboardEvent
MouseEvent
MouseButtonEvent
MouseMoveEvent
MouseScrollEvent
WindowEvent
As MouseMoveEvent
s are generated, the HandMorph
adjusts its screen position. When mouse and keystroke events arrive,
the HandMorph
coordinates the “dispatch” of events to the
proper morph under the hand as well as displaying tool tips and
carrying morphs in transit during drag operations.
As we saw in the previous chapter with ColorClickEllipse
, any
morph may override default Morph
methods to assert that it
handles various user events and the methods which take the associated
event objects when events arrive.
Basically, user input events are generated, a HandMorph
reflects any cursor movement, morphs react to events, each long
running task gets a time slice and makes some progress, any display
changes are updated on the screen, and the next step happens. Time
marches forward a step.
This happens over and over and over, keeping the juggler’s illusion that all balls in the air are moving at once. Underneath, the balls are each moving just a bit, in sequence.