How to create a new project with code - example 5
Last updated at 6:37 pm UTC on 25 July 2022
The following code create a new Morphic project and populates it with a text box:
| newProject |
newProject := MorphicProject new.
newProject name: 'Project 5'.
newProject showWorldMainDockingBar: false.
newProject world color: Color lightBrown.
container:= RectangleMorph new.
container layoutPolicy: TableLayout new.
container position: 20 @ 200.
"center submorphs"
container listCentering: #center.
container wrapCentering: #center.
container width: 600.
container height: 300.
container color: Color white darker.
tm := TextMorph new.
tm contentsWrapped: ''; hResizing: #spaceFill; vResizing: #spaceFill.
tm beAllFont: ((TextStyle default fontOfSize: 18) emphasized: 0).
container addMorph: tm.
newProject world addMorph: container.
ProjectViewMorph openOn: newProject.
tagBeginner