World lastKeystroke and openInWorld: aPasteUpMorph
Hi, I'm using pharo to teach smalltalk as first 'real' programming language at school. With older versions of pharo I was glad that my pupils could track keystrokes so easily by evaluating World lastKeystroke. With Pharo3.0/4.0 this only returns '<down>' independently of any keys I'm typing. f := PasteUpMorph new openInWorld. f takeKeyBoardFocus. f lastKeystroke. Is returning the empty string. Hence, my question: Is lastKeystroke broken, or how is it meant to be used now? Second problem: In older versions of pharo this would work: f := PasteUpMorph new openInWorld. b := EllipseMorph new. b openInWorld: f. But with Pharo 3.0/4.0 the last line raises an error: MessageNotUnderstood: PasteUpMorph>>startSteppingSubmorphsOf With f := WorldMorph new openInWorld. b := EllipseMorph new. b openInWorld: f. pharo freezes. So: How is openInWorld: meant to be used? Markus
Hi Markus, 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.
On Jun 10, 2015, at 18:50, Markus Schlager <m.slg@gmx.de> wrote:
Hi,
I'm using pharo to teach smalltalk as first 'real' programming language at school. With older versions of pharo I was glad that my pupils could track keystrokes so easily by evaluating
World lastKeystroke.
With Pharo3.0/4.0 this only returns '<down>' independently of any keys I'm typing.
f := PasteUpMorph new openInWorld. f takeKeyBoardFocus. f lastKeystroke.
Is returning the empty string.
Hence, my question: Is lastKeystroke broken, or how is it meant to be used now?
Second problem: In older versions of pharo this would work:
f := PasteUpMorph new openInWorld. b := EllipseMorph new. b openInWorld: f.
But with Pharo 3.0/4.0 the last line raises an error:
MessageNotUnderstood: PasteUpMorph>>startSteppingSubmorphsOf
With
f := WorldMorph new openInWorld. b := EllipseMorph new. b openInWorld: f.
pharo freezes.
So: How is openInWorld: meant to be used?
Markus
---> Save our in-boxes! http://emailcharter.org <--- Johan Fabry - http://pleiad.cl/~jfabry PLEIAD lab - Computer Science Department (DCC) - University of Chile
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
Hello Markus,
With older versions of pharo I was glad that my pupils could track keystrokes so easily by evaluating
World lastKeystroke.
With Pharo3.0/4.0 this only returns '<down>' independently of any keys I'm typing.
f := PasteUpMorph new openInWorld. f takeKeyBoardFocus. f lastKeystroke.
Is returning the empty string.
this lastKeystroke suff seems broken please, open an issue
Hence, my question: Is lastKeystroke broken, or how is it meant to be used now?
Second problem: In older versions of pharo this would work:
f := PasteUpMorph new openInWorld. b := EllipseMorph new. b openInWorld: f.
But with Pharo 3.0/4.0 the last line raises an error:
MessageNotUnderstood: PasteUpMorph>>startSteppingSubmorphsOf
also broken another issue to open :)
With
f := WorldMorph new openInWorld. b := EllipseMorph new. b openInWorld: f.
pharo freezes.
Yes, I dont think that you can open a world in the root world. Cheers Alain
So: How is openInWorld: meant to be used?
Markus
Hence, my question: Is lastKeystroke broken, or how is it meant to be used now?
Second problem: In older versions of pharo this would work:
f := PasteUpMorph new openInWorld. b := EllipseMorph new. b openInWorld: f.
But with Pharo 3.0/4.0 the last line raises an error:
MessageNotUnderstood: PasteUpMorph>>startSteppingSubmorphsOf
also broken another issue to open :)
Quick fix to make it work: just move startSteppingSubmorphsOf: from WorldMorph to PasteUpMorph. Cheers Alain
Le 10/06/2015 23:50, Markus Schlager a écrit :
I'm using pharo to teach smalltalk as first 'real' programming language at school. With older versions of pharo I was glad that my pupils could track keystrokes so easily by evaluating
Off topic, but I am curious as a teacher: how old the pupils you are teaching to? Thanks Hilaire -- Dr. Geo http://drgeo.eu http://google.com/+DrgeoEu
On Tue, 16 Jun 2015, Hilaire wrote:
Off topic, but I am curious as a teacher: how old the pupils you are teaching to?
I use Etoys or Scratch in grade 7 (age about 12 years) and Smalltalk in grade 10 (age about 15/16 years). They are attending regular "Informatik"-courses at Gymnasium, supposed to learn object-oriented modeling and programming. Markus
Cool Noury has some nice exercises for starters. Le 18/6/15 23:29, Markus Schlager a écrit :
On Tue, 16 Jun 2015, Hilaire wrote:
Off topic, but I am curious as a teacher: how old the pupils you are teaching to?
I use Etoys or Scratch in grade 7 (age about 12 years) and Smalltalk in grade 10 (age about 15/16 years). They are attending regular "Informatik"-courses at Gymnasium, supposed to learn object-oriented modeling and programming.
Markus
Hi markus how can we help you? what are the exercises that you have - started to work on - Wallet something that contains coins and you should know how much money you get - captchas - simple counter - (I was still lukring at the exercises of Noury) Stef Le 18/6/15 23:29, Markus Schlager a écrit :
On Tue, 16 Jun 2015, Hilaire wrote:
Off topic, but I am curious as a teacher: how old the pupils you are teaching to?
I use Etoys or Scratch in grade 7 (age about 12 years) and Smalltalk in grade 10 (age about 15/16 years). They are attending regular "Informatik"-courses at Gymnasium, supposed to learn object-oriented modeling and programming.
Markus
participants (5)
-
Alain Plantec -
Hilaire -
Johan Fabry -
Markus Schlager -
stepharo