=== Top of the Swiki === Attachments ===

AlignmentMorph

Describe the AlignmentMorph here:



Attributes and possible values



From the initialisation method

Examples



  1. Two examples with direct manipulation from Torsten Bergmann:
    http://www.phaidros.com/DIGITALIS/englisch/sqk/sqk00053.htm


  2. Similar examples done with Smalltalk code:


    AlignmentMorph newRow
    addMorph: (EllipseMorph new extent: 40@40; color: Color red);
    addMorph: (EllipseMorph new extent: 50@50; color: Color yellow);
    addMorph: (EllipseMorph new extent: 60@60; color: Color green);
    addMorph: (EllipseMorph new extent: 70@70; color: Color blue);
    position: 20@20;
    openInWorld



    Try also newColumn instead of newRow.
    Try using addMorphBack: instead of addMorph.



  3. StringMorph test openInWorld


    StringMorph test2 openInWorld

  4. PluggableButtonMorph example openInWorld


  5. Add the following two methods to the class side of AlignmentMorph:


    createClassNameMorph: aClass

    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



    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


    And evaluate:
    (AlignmentMorph createClassHierarchyMorph: AlignmentMorph) openInWorld.


    Or


    (AlignmentMorph createClassHierarchyMorph: BorderedMorph) openInWorld

  6. Squeak contains a nice game which may serve as an example of using AlignmentMorphs. See SameGame initialize and SameGame makeControls


20 Sep 1999 / Hannes Hirzel