s LearnSqueak.com

02 / PROJECT SOURCE WALKTHROUGH · SQUEAK 6.0

Messages become art.
Objects keep history.

Follow the live studio from a recorded Pen message to a drawn shape. Compile edited Smalltalk, inspect commands, and see how closures make undo possible.

3 executed examplesNative PNGs · copyable source

LIVE PEN LABNATIVE SQUEAK WINDOW
A real window rendered by Squeak. Click to inspect the full-size capture.

FOLLOW THE OBJECTS

  1. 01Recipe / editor
  2. 02Recording pen
  3. 03Command objects
  4. 04Real Pen + Form

PenRecordingPen collects PenDrawingCommand objects and bounds. PenPlayground prepares a fitted PenShapeMorph, then sends the recorded commands to its real Pen. PenCodeEditorMorph wraps the native text pane, styler, line gutter, and bindings. PenSceneCommand stores execute/undo closures.

READ → RUN → INSPECT → CHANGE

Inside the implementation.

Evaluate a complete Workspace recipe, then switch to Project methods to read the code it uses. These classes belong to this project; install the source suite first.

DESIGN CHOICES IN THIS PROJECT

One protocol, two receivers

The recipe sends familiar messages such as go:, turn:, and color:. A recording pen implements that protocol without drawing pixels. Later, each command forwards to a real Pen, adjusting distances and points for the fitted bitmap. This is polymorphism in a small, inspectable example.

Editor, model, and compiler

The editor is a PenCodeEditorMorph containing a native text pane, syntax styler, and line-number gutter. Its visible text is the compiler input. Updating only codeText: changes a backing value; the Workspace recipes use codeField setText: to change what Run actually reads.

Browser and Inspector buttons open the actual recipe and shape objects. A style change updates editor colors through the theme palette; it does not evaluate code. Code evaluation happens explicitly through Run or preparation for playback.

RUN THE SAME STUDIOS

Open the project in Squeak.

Use the existing Pen Studio image, or install the downloadable custom classes into Squeak 6.0. The bundle contains Smalltalk source and setup notes; it does not contain a saved image.

02 / Launch and inspect

Open a Workspace, select PenDemoLauncher run., and choose Do it. Each launcher action returns a native window in the same image. Alternatively open this studio directly with PenPlayground run.

The lesson recipes return a SystemWindow. Choose Inspect it, then inspect its model to follow the fields named in each example. Method listings belong in the System Browser; use the Workspace tab for a complete runnable expression.

03 / Browse and experiment

Find the class in the System Browser. Choose instance or class side as indicated above each method. Modify a message, accept the method, and rerun the example. These are live Smalltalk objects: you can inspect the scene, commands, Forms, and owner tree directly.

SOURCE AND RECORDING EVIDENCE

Recorded from the actual project.

The native runner files in the ten source files, compares every documented method with installed source, evaluates the exact Workspace recipes, and checks their resulting state. It stops automatic stepping before supplying the recording messages shown next to each GIF.

The PNGs are complete native window captures. GIFs use a shared reduced-color palette and repeat excerpts, so a loop boundary can jump. The website displays recordings; the live studios run inside Squeak. The runner closes its windows and exits without saving the image.

Return to the project guides →

Download original ↓