tags:

views:

109

answers:

1

In the Squeak Smalltalk environment, I am trying to learn Morphic. There are many, many Morphic classes and I cannot determine the most appropriate one(s) to use for my current application, and I prefer not to invent anything that already exists at this point. Links to relevant code/info would be appreciated. While Pharo might be nicer, I am stuck with Squeak atm.

My question is:
Using Squeak and Morphic, how do I create some sort of canvas, drop it into a movable, scrollable, resizable window, show it on the desktop, drop a circleMorph onto that canvas, and allow the user to grab the circle and move it around on the canvas?

Thanks!

+2  A: 

Open a workspace and type:

| window canvas circle |
window := SystemWindow new.
canvas := PasteUpMorph new.
window addMorphBack: canvas.
canvas bounds: window bounds.
circle := CircleMorph new.
canvas addMorphCentered: circle.
window openAsIs.

This will create a circle on your desktop that you can drag and drop. Browse the CircleMorph class to find other things you can do. Also, check out the Documentation section at www.squeak.org. There's a lot of good tutorials there.

mamboking
@mambo Thanks for your answer. As the question states, I need it on a canvas and in a window. I went to squeak.org and wiki.squeak.org first, but was hoping for some more specific help.
Robert Lamb
Edited to give a more complete example.
mamboking