links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Last updated at 8:58 pm UTC on 10 March 2003
HandMorph is the class representing a mouse cursor.

Morphic supports more than one hand, even hands controlled by other systems, called remote hands, or controlled by an event recorder, a HandMorphForReplay thingy. Normally, there's one primaryHand per World (kept in ActiveHand) and one activeHand during event processing. There's also the notion of a currentHand but I think, either primary or current but not both makes sense. A hand morph has some 30 instance variables - most of them results of poor refactorings. They hold internal states like time between double clicks or the active popup menu.

Each hand is an event source and you can register yourself for receiving events like mouse down or mouse moved. Normally, the hand automatically interacts with morphs so you don't need to register event handlers. Each hand also knows a keyboard focus, a morph that receives keyStroke events.

Each hand - normally represented by the hardware cursor - can switch to any form it wants and can bear user initials which helps to distinguish different mouse cursors. Actually all images but the primary hand are simulated. There are more instance variables to cache form images and to record damage done by morphs with which to redisplay theirselves while picked up.

Then a hand can send all events via a socket connection to some other remote hand. This code which burdens the already not trivial implementation, should be better factored out.

Finally, a hand controls tool tips (aka bubble help), popup menus and drag and drop. The hand also synthesizes the events it gets from polling during a world display loop.

There is a method category 'World menu' which implements the menus.

Also see: Worlds and HandMorphs for a fun intro to, ah, Worlds and HandMorphs.