[Newbies] Re: Annotated workspace for tutorials...
Sean P. DeNigris
sean at clipperadams.com
Thu Apr 15 21:55:15 UTC 2010
I played around and found two approaches. Neither work perfectly (there
seems to be a problem resizing SketchEditorMorph in general), but they give
you an idea of what's possible and how to attack:
1. Morphs can have layout policies that control how their submorphs are laid
out, so you can do something like:
sm := SketchMorph new.
sm openInWorld.
sm editDrawing. "bring up the sketch editor"
sem := World submorphs detect: [ :morph | morph isKindOf: SketchEditorMorph
].
sem clear. "erase the default sketch"
ws := Workspace new openLabel: 'Workspace'.
sem extent: ws panelRect extent.
sem center: ws panelRect center.
lf := LayoutFrame fractions: (0.01 at 0.01 corner: 1 at 1).
ws addMorph: sem fullFrame: lf.
sem comeToFront.
sem color: Color transparent.
2. There is a method layoutChanged that provides a hook to layout submorphs
manually. So you could do something like (where sem is an instance
variable):
PluggableSystemWindow>>layoutChanged
super layoutChanged.
sem ifNotNil: [ sem extent: self panelRect extent.
sem center: self panelRect center. ].
PluggableSystemWindow>>addAnnotation
| sm |
sm := SketchMorph new.
sm openInWorld; editDrawing.
sem := World submorphs detect: [ :morph | morph isKindOf: SketchEditorMorph
].
sem clear.
sem extent: self panelRect extent.
sem center: self panelRect center.
self addMorph: sem.
sem comeToFront.
sem color: Color transparent.
Not that you would necessarily put these methods in PluggableSystemWindow,
but you can see what's available.
Sean
--
View this message in context: http://n4.nabble.com/Annotated-workspace-for-tutorials-tp1755662p1934363.html
Sent from the Squeak - Beginners mailing list archive at Nabble.com.
More information about the Beginners
mailing list