AlignmentMorph class hierarchy example
Last updated at 8:30 pm UTC on 27 August 2016
The following AlignmentMorph example needs to be updated for 5.1
<li>Add the following two methods to the class side of AlignmentMorph:
createClassNameMorph: aClass
<html><pre>
| d |
d := AlignmentMorph newRow.
d centering: #center.
d color: Color yellow.
d borderColor: Color blue.
d vResizing: #shrinkWrap.
d hResizing: #shrinkWrap.
d addMorph: (StringMorph contents: aClass name).
d openToDragNDrop: true.
^d
<p>
createClassHierarchyMorph: aClass
| col d subCls |
d := self createClassNameMorph: aClass.
(subCls := aClass subclasses) isNil ifTrue: [^d] .
col := AlignmentMorph newColumn.
subCls do: [ :aSubclass | col addMorph: (self createClassHierarchyMorph: aSubclass)].
d addMorphBack: col.
^d
</pre>
</html>
And evaluate:
(AlignmentMorph createClassHierarchyMorph: AlignmentMorph) openInWorld.
Or
(AlignmentMorph createClassHierarchyMorph: BorderedMorph) openInWorld