|
Input handlingIn general, we can make a morph sensitive to input events by defining these methods appropriately:
keyUp:, keyDown: leftMouseUp: leftMouseDown:, middleMouseUp, rightMouseUp,... leftDoubleClick:, middleDoubleClick, rightDoubleClick: mouseMove: Morphic represents user actions such as pressing a key or mouse button using ui2Event objects. A ui2Event actually carries two kinds of information: its type, such as "leftMouseDown", and the state of the mouse buttons and certain keyboard keys when the event occurred. This allows a program to tell, for example, if the shift key was held down when the left mouse button was pressed. As events occur, they are placed into a buffer. Morphic removes and processes events from this buffer in order. Thus, even if a user occasionally gets ahead of the system, the system will eventually catch up. |