Help - Programming - Fancy Editor

Previous - Programming - Next

Many years ago I wrote my first text-editor (with help) in the programming language Pascal. It took me several weeks, but then I was learning Pascal at the time. At the end I had an editor like Squeak offers as a Workspace - but with just basic text-editing, and nothing else.

Now let's write our own editor, which will be like a fancy Workspace.

Again, nearly all of the work is assembling some bits and pieces from Squeak and combine them. Here are the steps to follow:

(1) By way of Worldmenu-flaps...-Stacks Tools make sure Stack Tools is a flap. (And read about flaps... on the flaps menu if you haven't done so.)

(2) Cmd-d the following lines

| edwin |
edwin := SystemWindow labelled: 'Fancy Editor'.
edwin openInWorld.

This will put a SystemWindow in your Project.

(3) Use the menu of 'Fancy Editor' in the top row to window color it's surrounding window anyway you please.

(4) Open halos on it and select from the menu halo the two choices

provide clipping - for this will take care you can collapse it with containin morphs
accept drops - for this will take care you can drop morphs into the SystemWindow

You must click these options to turn them on. Then dismiss the halo menu.

(5) Grab a Fancy Text from the Stack Tools flap and put it next to the 'Fancy Editor' window you just made.

(6) Click up the halos of Fancy Text, take its by its Pick Up halo (the one in the middle on the top row), and drop it into 'Fancy Editor'. (Dropping is dragging onto - the option accept drops you just set will assure it now is part of the SystemWindow. It needs to be dragged onto the large area, of course.)

(7) Click the halos of 'Fancy Text' and adjust its size (right hand corner below) so it fits the window of 'Fancy Editor'.

(8) Perhaps you also want to adjust its color by its halo (right hand row first form bottom).

Task accomplished!

You can use it like a Workspace, and indeed like a Workspace it will also run any code Squeak can run in textwindows. And you can collapse it, and thanks to provide clipping it will collapse the Fancy Text it contains with it.

By the way: Workspaces have more facilities, so don't rely overly much on your present Fancy Editor (copy and paste text from it to a Workspace if you want to be sure of keeping it).

The point of making it is to show you how easy basic programming is in Squeak, and to show how parts in Squeak fit together. But you can write text in it, and it helps if you click up the halos of 'Fancy Editor', click the debug halo (the wrench-like button on the right side) and choose 'explore morph' from that, to have a peep into the innards of what you made.

And what you made involved quite a lot of real OOP.

Previous - Programming - Next