Someone to critique my custom Morph?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Someone to critique my custom Morph?

Tim Johnson-6
Hi,

I have made a custom Morph to look for keyboard events when it is the
current mouse focus.  Is there anyone out there who could look at my class
and give me suggestions / observations?

I am wondering if I made any bad practices or bad oversights.  My
techniques were culled from a number of different tutorials and looking at
existing classes.  I have implemented it on a 3.6-based image.

I appreciate any help.

I will attach the class which you can file-in.  It is called
"KeyMoverMorph" and is in the category "My Morph".  Its behavior includes:

- drawing a border when it is mouse focus
- looking for keyboard events when it is mouse focus
- changes to color yellow when 'o' is pressed on it, blue when 'c' is pressed
- when it is focus, keyboard arrow keys move it up, down, left, and right

If there are better ways for me to do any of these things please let me know.

Thanks,
Tim


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

KeyMoverMorph.st (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Someone to critique my custom Morph?

Luke Gorrie-2
[hidden email] writes:

> I have made a custom Morph to look for keyboard events when it is the
> current mouse focus.  Is there anyone out there who could look at my class
> and give me suggestions / observations?

I'm also a Squeak newbie but I recently wrote a similar morph and
found a reasonably nice way to dispatch on keyboard events.
Details at the bottom of http://lukego.livejournal.com/2909.html
in case it's a source of ideas.

See also Object>>caseOf: for a select/case statement of sorts.


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners