1. Open a Workspace window.
2. In the Workspace window type the following code and then select “do it” (or Ctrl-d). To “do it” you will need to evaluate each line one at a time, in order, or both lines all at once. To evaluate one line, place the text cursor somewhere on that line, then select “do it” (or Ctrl-d). To evaluate both lines all at once, highlight both lines, then select “do it” (or Ctrl-d).
a := RectangleMorph new.
a openInWorld.
3. Pick up the object with your mouse cursor and move it somewhere else on your screen.
4. Now resize the box to something different. Type the following code in your Workspace window and then select “do it” (or Ctrl-d):
a extent: 150 @ 150.
5. Notice how the object responded to the message you passed to it.
6. Now create another object. Type the following code in your Workspace window and then select “do it” (or Ctrl-d):
b := EllipseMorph new.
b openInWorld.
7. Now you have two independent objects displayed. What if you moved the EllipseMorph on top of the RectangleMorph? Will it stick?
8. The EllipseMorph does not automatically stick to the RectangleMorph. They are still independent objects. To add the two Morph objects together, you will need to send a message for this. Move the EllipseMorph away from the RectangleMorph.
9. Type the following code in your Workspace window and then “do it”.
a addMorph: b.
10. What happened? Did you notice any change? What happens if you move your RectangleMorph around the screen? Do you now notice anything different? What might be happening?
11. You have added the two Morph objects together, but they are positioned differently. You will want to send another message so that they appear together. Type the following code in your Workspace window and then “do it”:
b position: a position.
12. Now move the composite Morph around your screen. What do you notice?
13. What do you notice about where the EllipseMorph is located inside the RectangleMorph? You might notice that the EllipseMorph is not centered like you might want. This is because position refers to the top left corner of a Morph. You can send different messages to locate the Morphs differently.
14. Now center the EllipseMorph inside the RectangleMorph. Type the following code in your Workspace window and then “do it”:
b center: a center.
15. What do you see now?
16. Save and Quit your Smalltalk image.