Hi Johan,

On Wed, 10 Jun 2015, Johan Fabry wrote:

this is probably not how it should be done, but to get the last keystroke I 
have been doing the following:

World activeHand instVarNamed: #lastKeyScanCode

If you find a cleaner way I’d be grateful if you can share it.

The solution proposed by PharoByExample, p. 228 is to override Morph>>handleKeystroke:

---8X---------------------------------
Morph subclass: #MyMorph

MyMorph>>handleKeystroke: anEvent
        | keyValue keyName |
        keyValue := anEvent keyValue. "integer"
        keyName := anEvent keyString. "string like '<up>' or 'a'"
        ...

m := MyMorph new.
m takeKeyboardFocus.
---8X---------------------------------

Markus

Reply via email to