SDSU CS 683 Emerging Technologies: Embracing Change
Spring Semester, 2001
Using Squeak
Previous    Lecture Notes Index    Next    
© 2001, All Rights Reserved, SDSU & Roger Whitney
San Diego State University -- This page last updated 05-Feb-01

Contents of Doc 4, Using Squeak


References

Squeak Smalltalk: A Quick Reference, Andrew C. Greenberg, http://www.mucow.com/squeak-qref.html


Reading

Squeak: Object-Oriented Design with Multimedia Applications, Guzdial, Chapter 2 sections 2.4- 2.5


Doc 4, Using Squeak Slide # 2

Some Squeak Environment


It is hard to explain on paper how to use GUIs. The best thing is to use the GUI and have an expert user nearby. The following may help you get started.

Smalltalk started on machines with 3-button mouse. Today's computers vary in mouse buttons and terminology. Smalltalker's originally used colors to denote different mouse buttons. I can never remember what these colors mean. I also can never consciously remember what any button on a mouse does. That information lives in my fingers and subconscious. So play with Squeak and train your fingers. Once you do that, you can forget the colors.

OS
Red
(Pointing, selecting)
Yellow
(Context-sensitive menu)
Blue
(Manipulate window)
Mac
Mouse click
Option-click
Command-click
Win (2 button)
Left-click
Right-click
Alt-left-click
Win (3 button)
Left-click
Middle-click
Right-click
UNIX
Left button
Middle button
Right Button

To use the Windows 3-button mouse setting right-click on Squeak's tittlebar and select the correct setting

Warning to Windows Users

Make sure that Squeak is set for the type of mouse you are using. It will make it easier to use Squeak.


Doc 4, Using Squeak Slide # 3
Squeak Versions

This course will be using Squeak 2.8. Squeak is evolving rather quickly. Squeak 2.9 will soon be finalized and Squeak 3.0 will enter alpha. Functionality is continually being added. Windows and menus will change. You can modify menus in Squeak. I have added SUnit to the versions of Squeak in Love Library lab and the BA 120 computer lab. On those machines SUnit will appear in some menus. Screen shots that follow are for Squeak 2.8 with SUnit added.

MVC & Morphic


Squeak has two different GUI mechanisms: MVC and Morphic. MVC (model-view-controller) is the original Smalltalk GUI. The startup screen in Squeak 2.9 and earlier uses MVC. Squeak 3.0 will use Morphic in the startup screen. Morphic is the new mechanism for GUI. Much if not most of the current activity in Squeak uses morphic. We will be using morphic in this class. GUI images in these notes will show morphic windows and menus. This means you fist have to get to a morphic project. The text book and demos in class will show how to do that.

Projects


Projects in Squeak are very useful. However, it will be a while before we have covered enough material to accurately define a project. A partial definition is that a project is a desktop with its own collection of windows. Squeak can contain a number of different projects at the same time. The state of the project (state of the windows in the project and all the objects in the project) is saved when you save Squeak. When you restart Squeak the state of each project is restored. When you create a new project you select which GUI to use: MVC or Morphic. When you start up Squeak for the first time you are in an MVC project. To get a Morphic project, you need to create a project and enter it. Now much of this will not make much sense until you see it and try it.


Doc 4, Using Squeak Slide # 4

Morphic Menus



When you click (Red or left-click) on the background in Squeak you get the World menu. The world Morphic menu is shown on the left above. Currently there are two submenus of interest: open and help. The open menu is shown in the middle, and the help menu is on the right. Clicking on the "open ..." item in the world menu displays the open menu. In the open menu we look at menu items: "morphic project", "workspace", and "browser".

You should perform the action described in the next few pages. One learns what one does.

Doc 4, Using Squeak Slide # 5
Windows


Most windows in Squeak have title bar as does the workspace window above. Clicking on the X on the left side of the title bar closes the window. Clicking on the O on the right side of the title bar minimizes/restores the window. Clicking on the icon next to the X displays a window menu. Clicking the Yellow (middle) mouse button inside the window displays a context sensitive menu.



When the mouse is in a window a scrollbar may appear (see above). If you click on the rectangle on the top of the scrollbar, the same context menu will appear. This is primarily for machines with one-button mice.


Doc 4, Using Squeak Slide # 6

Creating a Morphic Project


Get the open menu by selecting "open ..." in the work menu. In the open menu select the "morphic project" item. This will create a new window like:

Click in the window and you will enter the project. This will give you a new desktop. In the world menu in the new project select the item "previous project" and you will exit the new project.


Doc 4, Using Squeak Slide # 7

Workspace


Workspaces are good places to try out Smalltalk code. In the open menu select the item "workspace". You will get new window. In this window type "12 factorial". Select the text. Using the yellow button (right-click with 2-button Windows mouse) click in window. You will get a pop-up menu as shown below. Select print it in that menu. The selected code will be compiled and executed. The result will be displayed in the window.

Most of the items in the above menu are self-explanatory. Three important menu items are:

do it
Compile and execute the selected code
print it
Same as "do it" but also print the result of running the code
inspect it
Same as "do it" but also open an inspector window on the result of running the code


Doc 4, Using Squeak Slide # 8

Some Text Editing Short Cuts

Squeak text widgets, including most System Browsers, Workspaces, File Lists and Transcripts support text editing short cuts and some useful key commands. See http://www.mucow.com/squeak-qref.html for a complete list.

Select all text in a window
Click at the end or beginning of the window
Windows key command: alt-s
Mac key command: command-s
Select a line of text
Click at the end or beginning of a line

Select a comment (or string)
Click on either side of the character " ( ' for string)
Squeak then selects the text to the next " (') in that direction


Selecting text between [ ], or ( ), or { }
Click just after the leading [ or just before the trailing ]

Surrounding text with [ ]
Select the text
Windows: type alt-[
Mac: type command-[
Note the key actually toggles the existence of [ & ]
Same works with { and (


Doc 4, Using Squeak Slide # 9
On-line Help

Squeak does have some on-line help you can use to find key commands and other items of interest. In the World menu select the help item. You will get the following menu. Select command-key help for list of the command-keys. The world menu help is also useful. The definition for item accesses an on-line dictionary. Not really related to using Squeak, but I find it useful.


A compact list of the command keys is on the next slide. Click here for a PDF version.

Doc 4, Using Squeak Slide # 10

Squeak Command Keys

Command key = alt on PC, command on a Mac

Lower-case command keys
Upper-case command keys
a
Select all
A
Advance argument
b
Browse it (class name)
B
Browse it in same System browser
c
Copy
C
Compare argument to clipboard
d
Do it
D
Duplicate
e
Exchange
E
Method strings containing it
f
Find
F
Insert 'ifFalse:'
g
Find again


h
Set Search String


i
Inspect it
I
Inspect via Object Explorer
j
Again once
J
Again many
k
Set font
K
Set style
l
Cancel
L
Outdent (move one tab-stop left)
m
Implementors of it (message)


n
Senders of it (message)
N
References to it
o
Spawn
O
Open message browser (in selector lists)
p
Print it


q
Query symbol


r
Recognizer
R
Indent (move one tab-stap right)
s
Save (i.e. accept)
S
Search


T
Insert 'ifTrue:'
u
Align (toggle left, right, center)
U
Convert lf to cr in selection
v
Paste
V
Paste author's initials
w
Delete preceding word
W
Selectors containing it
x
Cut
X
Force selection to lowercase
y
Swap characters
Y
Force selection to uppercase
z
Undo
Z
Capitalize all words in selection
Note: for Do it, Senders of it, etc., a null selection will be expanded to a word or to the current line in an attempt to do what you want

<return> Insert return followed by as many tabs as the previous line
esc Select current type-in
shift-delete Forward delete character

Control-( [ { < ' " Enclose within, or remove enclosing delimiter

Text Emphasis
1
10 point font
6
Color, link, action-on-click
2
12 point font
7
bold
3
18 point font
8
italic
4
24 point font
9
narrow (same as negative kern)
5
36 point font
0
plain text (resets all emphasis)
-
underlined (toggles)
=
struck out (toggles)
_
negative kern
+
positive kern


Doc 4, Using Squeak Slide # 11
Scrollbars & General Settings

The default setting for scrollbars in Squeak is to be on the left side of a window and appear only when the mouse is in the window. Since English text is left justified, more text is on the left side of a window than on the right side of a window. Having the scrollbars on the left side of the window results in less mouse movement, since the mouse position tends to be near the text. However, MacOS and Windows places the scrollbars on the right. (Does anyone know why?). Since familiarity wins over comfort, Squeak allows you so set where the scrollbars are located.

To change the settings for scrollbars and a number of other things select the help item in the world menu. In the help menu there is an item called "preferences ...". Select that to get a window like:


If you hold your mouse over an item you will see text explaining the item. Click on scrolling to change the scrollbar settings.


Doc 4, Using Squeak Slide # 12

The System Browser


The system browser is central to create, modifying and browsing classes. To open a system browser select open in the world menu. In the open menu select the browser item.



Doc 4, Using Squeak Slide # 13
There are 8 different panes in the system browser window

Class Category Pane
Upper left pane
Lists categories of classes in Squeak class library

Class Pane
Second upper pane from the left
Lists classes in the selected category

Method Category Pane
Third upper pane from the left
Lists categories of methods in the selected class

Method Pane
Upper pane on the right
Lists methods in the selected method category

Instance
Pane labeled "Instance"
When selected the browser shows information about instance methods

Comment
Pane labeled "?"
Displays class comment

Class
Pane labeled "Class"
When selected the browser shows information about class methods

Text Pane (bottom pane)
Displays methods, class comment and class definition


Doc 4, Using Squeak Slide # 14
How to Find Stuff in the Browser

One can always just search the browser manual. I do this at times. Categories of classes helps to reduce the search. Look in categories that you think should contain the item you are looking for. The package browser is good for this.

Classes

If you know name of the class you are looking for, type the name of the class in a text window (workspace for example), select the name, then type alt-b (windows) or command-b (mac). A new browser will open on the class. Squeak has some smarts. If you just type the name of the class and then alt-b, Squeak usually selects the correct thing for you.

If you do not know the entire name of the class, use the context menu in the category pane of the browser. The find class item takes fragments of class names and provides you with a list of likely matches.


Copyright ©, All rights reserved.
2001 SDSU & Roger Whitney, 5500 Campanile Drive, San Diego, CA 92182-7700 USA.
OpenContent license defines the copyright on this document.

Previous    visitors since 05-Feb-01    Next