Hi all,
I've been working on Phratch, a port of MIT Scratch to Pharo, mostly to
learn Smalltalk and also because Scratch is a great learning environment
and I can't bear to see it end up in Flash.

So I've been digging about in the old code to fix bugs and I'm getting a
sense that there's some conflict between the way the Scratch team got
things working in Squeak, and the way the Pharo team things want things
done.

I must say I think the Pharo team have things right in their drive for a
cleaner, simpler system, however that means I'm a bit stuck.

See the attached image of my Scratch script.

Here's where I am...
1. Keyboard events for 'When <key> pressed' HatBlockMorph (with then pen
commands) work fine as these follow the regular Morphic event model
2. But 'if <key> pressed' operation (with the stamp command inside) doesn't
work because it relies on polling the InputEventSensor, and I think this
bit of this class doesn't work as I expect.

My view right now is that for 2, I need to use some kind of polling, and
InputEventSensor has methods such as keyboardPeek and peekKeyboardEvent
that imply you can poll, but looking at the implementation, which uses
WaitfreeQueue I can see that calling these methods results in events being
consumed, hence my post to Stack Overflow...
http://stackoverflow.com/questions/16395418/cant-peek-keyboard-events-multiple-times-in-smalltalk-pharo-2

I've hacked around to come up with something that sort of works, outlined
in this post:
http://stackoverflow.com/questions/16495436/saving-modifications-to-existing-kernel-methods-to-monticello
...but I get the feeling I'm doing the wrong thing here, and that I should
come up with a solution that better fits the 'Pharo way'.

So, let me know what you think. I'm happy to provide more info and to
research better solutions, let me know...

Finally, apologies for the long post!

Best regards,
-Eric.

-- 
Eric Clack
ericcl...@googlemail.com
East Sussex, England.

<<attachment: keypress.gif>>

Reply via email to