Drawing on World

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

Drawing on World

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


--
Pozdrawiam:
Filip
GG: 2486889
mail: [hidden email]

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Drawing on World

Herbert König
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
#drawOn:

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
#openInWorld.

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
Handles".
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@300.


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


hth,

Herbert  

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