I'm debugging some keyboard event code and I want to loop with a sleep (to give me a chance to create the keyboard event), however when I do this Pharo won't let me quit with Command-. so debugging is difficult. I had to wait 500 seconds to fix something in the code below...
100 timesRepeat: [
Transcript show: 'Type an a... '.
(Delay forSeconds: 5) wait.
(Sensor keyPressed: $a) ifTrue: [ Transcript show: 'you pressed a' ].
]
So how can I make Command-. work, or is there something more suitable than (Delay forSeconds: 5) wait.
?
Works fine in Squeak on Mac OS X (using peekKeyboardEvent
, it does not have keyPressed:
). So it's not your code's fault, interrupting this should work fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With