links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Last updated at 4:29 am UTC on 5 March 2017
A window used as a scratchpad area where fragments of Smalltalk code can be entered, stored, edited, and evaluated. (Inside Smalltalk, vol I, p. 71)

To open a workspace window in Squeak, one possibility is to bring up the World menu, select "open...", and then select "workspace".

Uploaded Image: Workspace.png

You can then type in any Smalltalk code inside the workspace window and execute it or inspect it. This is normally done by typing in some code, highlighting it with the mouse, and then selecting "do it" or "print it" or "inspect it" from the pop-up menu. Or "debug it" to open a Debugger on the code. (To bring up a pop-up menu in Squeak, use the "yellow" mouse button, normally the middle or right mouse button, or option-click on a Mac. Or you can use the menu shortcut keys, such as cmd-d, alt-p, etc.)

For example, if you type 3 + 4 in a workspace, highlight it, and select "print it" from the pop-up menu, it will print the result 7. You can type any small or large piece of Smalltalk code... try also

   100 factorial 

   #(3 2 5 65 -1) asSortedCollection.
You can create and use temporary variables local to the workspace. You don't need to declare them like in methods. Variable names starting with a lowercase letter will automatically be created as a local variable (e.g., i := 2). Variable names starting with an uppercase letter will cause a dialog box to question if you want to create a Global variable or pick from similar variables (e.g., I := 2). If you create a Global variable and save your image you will need to delete it explicitly to remove it and free the object represents (e.g., Smalltalk removeKey: #I).

In Morphic, if you want to be able to access morphs on the screen from inside your workspace, you can turn on the "create textual references to dropped morphs" option in the workspace titlebar menu. When that is enabled, you can drag any morph into the workspace window, and a variable reference to that morph will appear in the workspace, which you can then send messages to. See FAQ: How do I access a Morph from a Workspace?

Open a Workspace with content

See also the "Code in Text Windows" section of Basic Squeak Development Tools for more info on what you can do in a Workspace or other text window.

Saving Workspace to a File

How to set the pane background of a Workspace to a picture

Make your life easier! If you want tab-completion and syntax highlighting, check out Shout and eCompletion.

Note on the implementation of Workspace

The model of the SystemWindow is an object of the class Workspace.
Uploaded Image: CollaborationDiagr.GIF