Keyboard events in Morphic

Martin Pammer mpammer at vrz.net
Fri May 29 18:44:00 UTC 1998


Dear Squeakers

Tim Olsons SameGame showed us how to develop an entertaining game with the
morphic
framework.

As for learning Morphic I decided to port a game I have written for VSE
and Dolphin Smalltalk as an excercise.

I encountered the following 2 problems.

1.) I have a class #MyGame that is a subclass of #AlignmentMorph. I want to
 add
some submorphs (kind of tiles) and I want #MyGame to handle keybord input
(cursor keys)
to move those tiles.

I tried #on:send:to: and #on:send:to:withValue: but I had no success.
Overwriting keyStroke: did not get me further.

It seemed that I did not get those #keyStroke events.

Looking in the hierarchy for senders of #keyStroke: did not help me much
either.

Maybe someone can shed some light on this.

2.) When I create a morph like in the following example
initialize
     | m |
     super initialize.
     self extent: 400 at 200.
     m := BorderedMorph new
          color: Color black;
          extent: 20 at 20;
          position: 30 at 30.
     self addMorph: m.
and then I ask the morph m's position I get somthing like 183 at 53 and not
the expected 30 at 30.

What is wrong with this ?

With best regards

Martin Pammer
mpammer at vrz.net





More information about the Squeak-dev mailing list