[Newbies] KeyPress On World of Squeak Wonderland (was: Disappointed)

Ron Teitelbaum Ron at USMedRec.com
Wed Nov 8 16:07:48 UTC 2006


Hi Jeff,

 

Welcome to the beginners list!

 

I appreciate the fact that you are sticking with the problem.  That in my
opinion is the best way to learn.  I didn't answer your question because I
do not feel that I am an expert in Wonderland.  If the question was
something like how can I map a key to so some action that is pretty easy, IF
that action is an isolated easily called method.  Something like: Utilities
garbageCollectAndReport.  This is a class method and there is no instance
that needs to be sent to.  

 

If a key stroke needs to be captured and affect a running instance it is a
bit more difficult to do but still very possible.  The issue here is that
there is a complicated event loop that needs to be tapped into but this
would be very difficult to explain to someone with limited experience.  The
fact that you are using wonderland means that there is probably already a
hook to do what you want so a complicated explanation of what I know will
probably only confuse the matter and make things more difficult for you.  

 

There are people on this list that have much more experience with
Wonderland, but nobody that will answer your question within hours.

 

I would love to have Squeak be much more a pleasant experience for you.  My
suggestion is that you start slower and work on understanding basic concepts
of Squeak.  Do more tutorials; look into how some things work before trying
to extend them. 

 

Also a comment, starting with the assumption that people are not going to
help you is discouraging to people who might.  People are more likely to
help people that work hard themselves and will benefit from the help and
will appreciate that help.  I think you have the work hard part down.  You
need to be a bit more appreciative of the effort and time that goes into
helping you.

 

Now to your question: Matthias was right and he sent you to exactly the
place you needed to go.   I just loaded a 3.8 image and did the helicopter
tutorial.  I have to say it was great fun!  Wonderland is a very nice piece
of code and I can see that it would be fun to play with.  The tutorial is
fun but the concepts are not easy and how the authors did what they did is
very clever but also difficult especially when you venture off the beaten
path.  You picked a hard place to start!  That by itself can be very
frustrating.   

 

Here is your answer but the answer is not perfect.  What I noticed is that
the keys only have focus when the actor is under the mouse.  There may be a
way to make this work in the context of a world but I couldn't get it to
work that way.  The world does not appear to have a reactions collection,
but there does seem to be a little hook in Scene that might have been
intended to work that way.  Again this is an advanced concept.  I also tried
adding a reaction to the ground to make it easier for this to work.  The
ground accepted the reaction but did not act on it.  I added a reaction of
[:event | self halt] but that did nothing so maybe background items like
ground and sky don't quite work or don't respond to certain reactions the
way other actors do.  It makes sense that Wonderland might be written this
way.  If you added a right key press to multiple objects how is it supposed
to know which item the key press should control.  There could be a number of
ways to fix this like adding an actor that is a control stick or something,
then placing the mouse over the control stick would work the helicopter.
(just a suggestion of where you might go from here)

 

Ok so here is the code: 

 

helicopter addResponse: [:event | 

            event getMorphicEvent keyString = '<left>' 

                        ifTrue: [helicopter move: #left].

            event getMorphicEvent keyString = '<right>'

                        ifTrue: [helicopter move: #right].

] to: #keyPress

 

I hope that helps, welcome to the list and

 

Happy coding,

 

Ron Teitelbaum

President / Principal Software Engineer

US Medical Record Specialists

Ron at USMedRec.com 

 

  _____  

From: beginners-bounces at lists.squeakfoundation.org
[mailto:beginners-bounces at lists.squeakfoundation.org] On Behalf Of Jeff
Sent: Wednesday, November 08, 2006 12:28 AM
To: beginners at lists.squeakfoundation.org
Subject: [Newbies] Disappointed

 

I'm pretty disappointed with this list at the moment. My last post,
"beginners questions" talked about how beginners often don't get their
questions answered and pointed out that often when the experts see that an
answer, ANY answer, was given they then assume the question was answered, so
they don't offer anything more. Now I do appreciate Matthias's honest
attempt to answer the question, so I don't want this to be misconstrued as
an attack on him. But he obviously misread it. And, well, once people saw
that the question of how to make a wonderland actor move in response to
mouse clicks had been answered, I didn't get any more help. The question I
asked was how to move a wonderland actor with the arrow keys, and I need to
do that without the actor having the focus. Unfortunately, since it's been
taking so many hours for the messages I've tried to send to get posted on
here, (I think I had screwed up joining the list somehow, and redid it so
hopefully that problem is solved), it took me a full day to get my question
asked and now another full day to explain that the answer I got was to a
different question. By the by, I've been spending about 10 hours a day for 5
days now trying to solve this problem. It's getting quite frustrating for me
and making me want to give up on squeak.
<http://imgfarm.com/images/webmail/rt/img/img1017a1.gif> 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20061108/4fcba240/attachment-0001.htm


More information about the Beginners mailing list