[up] [next]

Opening a workspace

For your first excursion into the smalltalk language, you should first learn how to open a workspace window and how to leave the debugger in case you ran into an error (which is quite likely -).

A workspace allows you to enter smalltalk code and execute it
(this is also refered to as "immediate execution", since you can typeIn some piece of code and immediately evaluate it)

Select the [-->]workspace item in the Launchers [-->]tools menu for a new workspace.

[Workspace-menu-screenshot]

The above opens a view which looks similar to:

[Workspace-screenshot-1]

You can use workspaces as text scratchpads, as copyBuffers or to evaluate Smalltalk expressions (which is their main use).
Expression evaluation is called "doIt evaluation", or "doIt" for short.

Also, you can evaluate some smalltalk code and have the result printed into the workspace. This operation is called "printIt". In the following, we will refer to both actions as doIt.

DoIts are perfect to try out something quickly; you can evaluate expressions to send messages, without a need to write a program which remains permanently in the system (and has to be removed later).

To execute some smalltalk code, type it into the workspace:

[Workspace-screenshot-2]

select it (using the mouse):

[Workspace-screenshot-3]

and evaluate it with the workspaces middle-button [-->]printIt menu function:

[Workspace-screenshot-4]

the result is displayed in the workspace:

[Workspace-screenshot-5]

There are also keyboard accelerators for the most common operations;
"doIt" is usually bound to "Alt-d" and "printIt" to "Alt-p".
Finally, a selection is quickly by made by pressing the "ESC" key, which selects the current lines text from the beginning to the current textcursor position. (i.e. a printIt can be done with two keys: "ESC" followed by "printIt")
A list of accelerators is found in "Getting started - Keyboard accelerators".

Try a few expressions; such as:
(dont care for the smalltalk syntax - the meaning will be explained later)

    1 + 2
    2 sqrt
    Transcript showCR:'hello world'
    Transcript showCR:(2 sqrt)
    (Button label:'hello') open
    Workspace open

Leaving the debugger

Whenever an error is encountered, smalltalk opens a debug window, which displays the state of execution and a walkback list, showing how you got to the point where the error was detected.
As a beginner, you should probably not care for all the information as displayed, but instead simply abort whatever operation you started.

So, if you get into the debugger while evaluating the following examples, simply press the debuggers abort button and retry whatever you did (but look for any typing errors - otherwise you may get another debugger)

To get used to the debugger, try the following example (which contains an error) in a workspace; do not try it from within the document browser - the browser catches errors and displays a warning - instead of opening a debugger window):

    1 / (1 min:0)
In the debugger, press the "abort"-button to leave the erronous execution.
For more information on what is shown in the debugger and how to use it, read "Using the Debugger".


Continue in "Smalltalk basics".


[stx-logo]
Copyright © Claus Gittinger Development & Consulting
Copyright © eXept Software AG

<cg@exept.de>

Doc $Revision: 1.17 $ $Date: 1999/08/10 13:05:26 $