CS 683 Emerging Technologies: Embracing Change Spring Semester, 2001 Using Squeak |
||
---|---|---|
© 2001, All Rights Reserved, SDSU & Roger Whitney San Diego State University -- This page last updated 05-Feb-01 |
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.
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.
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.
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.
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.
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
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
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.
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
|
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
|
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.
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.
There are 8 different panes in the system browser window
Class Category Pane
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