s LearnSqueak.com

01 / PROJECT SOURCE WALKTHROUGH · SQUEAK 6.0

Draw with a Pen.
Build a real form.

Start with the original studio: a retained bitmap, editable fields, color buttons, and validation. Follow how native controls turn model state into pixels.

3 executed examplesNative PNGs · copyable source

CLASSIC STUDIONATIVE SQUEAK WINDOW
A real window rendered by Squeak. Click to inspect the full-size capture.

FOLLOW THE OBJECTS

  1. 01Controls
  2. 02Validated values
  3. 03Form + Pen
  4. 04ImageMorph

HelloWorld owns a panel, text fields, buttons, status labels, and an ImageMorph. The Pen writes into a separate Form; the ImageMorph displays that bitmap. UI actions validate first, then replace the displayed Form.

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

Why retain a Form?

Drawing directly on the screen would be lost when the window repaints. Here the Pen draws into a Form, and the ImageMorph redraws that same image when needed. A new Draw operation builds another Form and installs it through image:.

origin := (form extent - (side@side)) // 2 centers the square in bitmap coordinates. north; turn: 90; down points the Pen across the top edge. Four cascaded go: and turn: messages close the shape.

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 HelloWorld 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 ↓