6 Visual with Morph

Morphic is a user interface framework that makes it easy and fun to build lively interactive user interfaces.

John Maloney

What would we expect if we asked for good support for building GUIs in a programming system?

All modern computers (and phones, etc) have high resolution color displays. Any software running on them, that is accessible to a user, needs to show stuff on that Display.

Conventional UI managers (that is, Operating Systems and Web Browsers) started by including only the most basic GUI elements first: basic text editors, buttons, simple lists, scrolling for large content, and (usually) multiple resizeable overlapping windows. Anything else needs to be handled via additional libraries. While there are libraries for handling richer content (D3.js and Matplotlib are examples), the result is not consistent, neither for developers nor for users.

Cuis-Smalltalk takes a different approach, pioneered by Smalltalk-80 and especially Self. We will get into detail in the next chapter, The Fundamentals of Morph. For now, let’s deal with Morphs directly.

We take the high quality Display for granted, as well as a mouse, finger or other pointing device. And we build on the objective of providing ample possibilities for GUIs both in existing, and in novel styles and designs yet to be invented. Additionally, in the usual Smalltalk way, all the framework code is available for study and modification. There are no third party libraries. Only the lowest level code is precompiled, but that still can be overriden or changed.

Therefore every object you see in Cuis-Smalltalk is a Morph or is composed of Morphs. Basically, a Morph is an object with state and behavior that can also depict itself on a computer display screen.

Because Morphs are useful, when you look at class Morph in a Hierarchy Browser you will see a large number of methods and many, many subclasses. But the basic ideas are quite simple.