links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Morph keyboard event
Last updated at 5:04 pm UTC on 16 January 2006
If you want your morph to get keyboard events, redefine the following methods

MyMorph>>handlesKeyboard: evt
   ^ true

MyMorph>>mouseEnter: evt
   evt hand keyboardFocus: self 

MyMorph>>mouseLeave: evt
   evt hand releaseKeyboardFocus: self 

keyDown: anEvent
"Handle a key down event. ."
  anEvent keyCharacter = $a
     ifTrue: [self doSomething].
  anEvent keyCharacter = $q
     ifTrue: [self doAnotherOne]