|This page has links to websites or programs not hosted or created by Scratch or Wikipedia. Remember to stay safe while using the Internet, as we can't guarantee the safety of other websites.|
|This article or section documents a feature not included in the current version of Scratch (2.0). It is only useful from a historical perspective.|
Morphic is a graphics system which uses graphical objects called Morphs for simplified GUI-building. It was originally developed by Randy Smith and John Maloney (a Scratch Team member and Squeak developer) for the programming language Self, but later rewritten in Squeak.
Morphic systems have an inheritance system: a morph can inherit from another, improving on the parent. Morphic inheritance begins at the root class Morph. Each Morph is a subclass of Morph either directly or indirectly. For example, the hypothetical ResizeHandleMorph is a subclass of DraggableObjectMorph which is a subclass of Morph.
An example of inheritance
A hypothetical inheritance of Morphs is shown below:
Morph CompoundMorph (contains many Morphs) FrameMorph (rectangular frame, resizable and draggable) WorldMorph (contains all other Morphs) WindowMorph (graphical window) DraggableMorph (is draggable) ResizeHandleMorph WindowResizeHandleMorph (for windows) SliderMorph VerticalSliderMorph HorizontalSliderMorph ScrollBarMorph VerticalScrollBarMorph HorizontalScrollBarMorph WindowTopBarMorph ButtonMorph CancelButtonMorph TextBoxMorph NumberOnlyTextBoxMorph
Inheritance is used to either improve upon a morph or specialize it for some purpose. The base Morphs should have lots of simple functionality which is then used by higher-level Morphs, which reduces code redundancy.
Some help can be found here.
Creating Morphs in Squeak
A morph is a special form of a generic Class, but it is a subclass of Morph rather than Object (root class). To open a new Morph, use the code (for a BouncingAtomsMorph):
BouncingAtomsMorph new openInWorld.
To create customized morphs, see Squeak Tutorial: Morphic classes.
Via GUI editing
To access the Scratch Morphs, one must first use the Shift-Click R method and turn fill screen off.
Open the World menu and pick the choice labeled "new morph..."
Clicking on that option then opens the "Add a new morph" menu. This has a list of all subclasses of
Morph on which if you click, you get an instance of that morph to place anywhere on the