[Newbies] Drawing on World

Herbert König herbertkoenig at gmx.net
Fri Nov 28 18:36:08 UTC 2008

Hello Filip,

FM> I found out whats my problem with drawing - World is instance of PasteUpMorph, not Canvas.
FM> So I have question: how to draw Morph on World? My object has sub-morph.

nobody has replied yet so let me try:

If your problem really is getting #drawOn to work, I never tried, but I
know on the swiki there is a tutorial by Jim Benson named "Why Morphic
is Way Cool". I enjoyed reading it very much and I know it covers

Actually a Morph should draw itself with all submorphs if you send it
#openInWorld or #openInHand.

To build a complex Morph, start with one and then add submorphs using
#addMorph or #addMorphBack, the latter if you need them in the
submorphs collection in the sequence you added them. When finished
send it #position: aPoint or center: aPoint, then send it

Something to play in a Workspace:
sheet := RectangleMorph new openIWorld

Do it, use the halo of the newly created Morph to scale it.

line :=  LineMorph new openIWorld

Do it, use the red Halo of the line and in the menu pick "show
Use the yellow handles to drag the line over your sheet, then in the
Workspace doIt:

sheet addMorph: line

They behave as one complex Morph now.

To change the size of the sheet, send it #extent: aPoint
to change the the position of the line try:

line vertices at: 1 put: 200 at 300.

Then there is LineMorph>>from:to:color:width:
to create a line.



More information about the Beginners mailing list