Getting started
Contents
This document will give you some short information, on
how to start & stop the system. You will also learn
how to leave the system once you entered the debugger
or if the system seems not to respond anymore.
Also, you will get a short introduction of how to enter text,
use the scrollbars and how to edit text.
To start Smalltalk/X,
type "smalltalk"
at the Unix prompt:
% smalltalk
installing autoloaded classes ...
installing patches ...
starting Transcript ...
starting main-menu ...
When started, Smalltalk/X
will read and evaluate a script-file
called "smalltalk.rc"
,
which consists of regular smalltalk expressions in
fileOut-format
(i.e. smalltalk
expressions separated by an exclamation mark '!').
Smalltalk looks for this file FIRST in your current
directory, THEN in some standard places
(usually "/usr/local/lib/smalltalk/smalltalk.rc"
).
The expressions in this script will set up some default
behavior (for example fonts to use) and finally start
both a Transcript-window and a Launcher-menu.
The Transcript will play the role of a smalltalk console
where relevant system information is shown. The Launcher
allows startup of other useful tools, these are described
in more detail later.
You can of course modify the startup script according
your personal preferences and add your own tools there.
More info on these script files and startup actions is found in the
documents
"installation"
and especially in
"configuration & customization".
To leave the smalltalk system, use the exit
function from the Launcher (single mouse click on exit).
The Launcher will show a box asking if you would like
to save the current state of the smalltalk system.
If you choose save & exit,
the whole state will be saved in a so-called snapshot-file;
this allows you to later restart smalltalk and continue
where you left it.
Choosing exit will NOT create a snapshot.
If you changed your mind and you do not want to leave
smalltalk, press the cancel button.
When Smalltalk/X is restarted,
it will look for a file called "st.img"
and,
if present,
load the state found in this file.
If you saved your snapshot under another name, use the
following command line when restarting smalltalk:
smalltalk -i nameOfImage.img
If you want to start Smalltalk/X from scratch,
ignoring any snapshot image,
use the ignore flag, as in:
smalltalk -I
Whenever some error occurs in smalltalk, a debugview
is popped up, showing where the error occurred and how
the system got there (called a backtrace or walkback).
The debuggers actions are controlled by a set of buttons,
and a popup menu in the walkback view for the less
frequently used functions.
The possible button actions are:
There are many other button and menu functions in the debugger.
Read
"using the debugger"
for more information.
The debugger can be entered either on request
(for example: halt
sent to any object),
via a breakpoint
or if an error such as division by zero,
array bounds check etc. occurs.
You can also type CTRL-C in any view to force the corresponding
view process being interrupted and a debugger opened on it.
Finally, pressing CTRL-C
in the terminal (xterm-) window where smalltalk was started,
will force a hard-interrupt, which interrupts any running process -
even the scheduler or event dispatcher process.
(On some systems, this key is labelled INTR or DEL.
See the Unix manual page on the stty
command for details.)
Whenever a serious error occurs within the debugger itself
(just imagine, you have changed the Scrollbar class which
is used indirectly in the DebugView), you will find
yourself in a line by line debugger called the MiniDebugger,
which allows some
limited debugging without using the graphical user interface.
The system considers errors occuring in a debugger as serious
(i.e. recursive errors in the graphical debugger).
- Type "?" at its prompt to get a list of options.
- try "c" (for continue)
- try "a" (for abort)
- if that does not help, try "T" (for terminate)
If all of the above fails, you should exit smalltalk.
In rare cases (other smalltalk processes are running),
the MiniDebugger may seem to not react to your input.
If this happens, press the interrupt key (as described above) and try again.
The interrupt will reenter the MiniDebugger in an exclusive
input mode and stop any scheduling of other processes.
Many views offer functions via a PopUpMenu.
This menu is activated by pressing the middle (or, if you own a 2-button
mouse, the right) mouse button in the view.
(Therefore, it is sometimes referred to as middleButtonMenu).
The menus entries are view and sometimes context dependent.
Typically, they offer operations on the contents or the current
selection.
The scrollbars shown beside the actual text work
as usual, however, they provide the following special
behavior:
- when the mouse-button is pressed below or above the
so-called thumb, the text is
scrolled page-wise (one page for every click).
- If the SHIFT key is pressed while the mouse
button is pressed, positioning will be to that
position. Thus you can position quickly within an even
large text.
(see more on text positioning in the section on keyboard
commands).
Text is selected using the left-mouse button:
- press the button over the first character to be
selected,
- while-being pressed, move the mouse-pointer to the
end position
- release the mouse-button.
The current selection will be highlighted.
Pressing the
left mouse button again makes the system forget the
old selection and start a new one, except when you
press the SHIFT key while pressing the button.
In this case, the current selection will be expanded.
You can expand a selection at any time, even if you
leave and reenter the view containing the selection.
It is therefore possible, to scroll the view (using
the scrollbar) or perform any other function (page-up
or page-down), required to make the desired end-position
visible. A selection can be expanded in both directions,
any number of times.
It is also possible to move the mouse-pointer out-of
the view, while the mouse button is being pressed. The
view will then start to automatically scroll. The farther
away you move the pointer from the views border, the
faster will it scroll. This is the easiest way of selecting
text: just let it scroll by and stop when the end-position
arrives.
Double click will select wordwise, while triple click will select
linewise.
If you keep the button pressed and start to move,
after a double click it will select whole words;
moving after a triple click will select whole lines.
A quadruple click selects the whole text.
There are also two convenient keyboard shortcuts for selecting:
- CMD-SHIFT-A - select all
to select the whole text
- ESC
to select from the beginning of the line up to
the current cursor position. (Thus to evaluate
something in a workspace, you have to press two keys only:
ESC followed by CMD-d.)
All views showing text allow you to perform the usual
functions via a pop-up-menu, which is activated with
the middle mouse button. For some of them, keyboard shortcuts
are available (actually there are more functions available
via the keyboard than there are on the menu). Currently,
the following keyboard functions are available:
command key functions (*):
- CMD-x - cut
the selected text is deleted
- CMD-c - copy
the selected text is copied into the PasteBuffer
- CMD-v - paste
the contents of the PasteBuffer is inserted at the
current cursor position. If there is currently a selection,
the selected text will be replaced.
- CMD-s - search
opens a panel to start a string search
- CMD-f - search forward
search forward in the text, position to the next occurance of
the last searchstring
- CMD-b - search backward
search backward in the text, position to the previous occurance of
the last searchstring
- CMD-w - select word
selects the word under the cursor
- CMD-g - goto linenumber
opens a box to enter a linenumber
Some keyboards (for example on sun-workstations) provide
function keys labelled copy, cut,
paste and so on.
These keys will also perform the expected functions.
control-key functions, these allow more cursor positioning:
- CNTL-a - start of line
position the cursor to the begin of the current line
- CNTL-e - end of line
position the cursor to the end of the current line
- CNTL-m - match
position the cursor on the matching parenthesis.
other functions which affect the cursor position:
- SHIFT-Return - non inserting cursor return
- SHIFT-Tab - non inserting tab
- Home - home
move the cursor to the very beginning of the text
- END - end
move the cursor to the very end of the text
- PageUp - previous page
- PageDown - next page
The following keyboard command is available in views
showing code:
- CMD-a - accept
the whole text (not just the selection) will
be installed and changes be made permanent.
The definition of what exactly installing
means is context dependent.
For example, in a FileBrowser,
the text will be saved into the edited file.
In a SystemBrowser, the current method will be
recompiled and installed.
In an inspector, the value will be stored into the selected instance variable.
Please read
"configuration & customization"
on how to add/change function keys settings.
Finally, see the keyPress:x:y:
methods
in the TextView
class and its subclasses.
You can easily modify these to add more functions.
Sorry:
currently there is no "undo" function,
however no change in the text will have any permanent effect,
unless you accept the new text.
Most views showing code and especially workspaces allow you to
select some text and immediately evaluate this as a
smalltalk expression
(remember the old Basic-interpreters ? :-).
The middle-button-menu function doIt will do
this, by parsing the selected text and silently evaluating
the corresponding smalltalk expressions.
For example, open a workspace and type:
Transcript showCr:(100 factorial)
or:
Workspace open
select the text and evaluate it using doIt.
Unless the expression does some printing itself (as in the first example),
the result of the evaluation is not shown anywhere.
To see the result of such an evaluation, use the middle-button-menu function
printIt.
Just like doIt, this will evaluate the expression,
in addition, it will insert a printed representation
of the result at the current textcursor position.
See the difference between doIt and printIt
when executing:
100 factorial
Finally, inspectIt will open an inspector
on the result, where you can have a look at the resulting
object in more detail.
Try to inspect the result of:
Array new:10
Each has a convenient keyboard shortcut:
- CMD-d - doIt
the selected text is evaluated as a smalltalk expression
- CMD-p - printIt
the selected text is evaluated as a smalltalk expression,
a printed repesentation of the result is inserted as the
new selection (use cut to remove it).
- CMD-i - inspectIt
the selected text is evaluated as a smalltalk expression
and an Inspector is opened on the result.
Notice that these keyboard shortcuts are defined in the startup
scripts (usually in "display.rc
).
Read "configuration & customization"
and have a look at the startup files.
Files containing smalltalk code
(in fileOut-format)
can be loaded into the system either by evaluating:
Smalltalk fileIn:filename
using doIt in a workspace,
or, more comfortable, using the FileBrowser.
To load a file using the FileBrowser, select the file
and apply the middlebutton menus fileIn function
in the upper (filelist) panel.
Watch the Transcript for what is going on.
Smalltalk/X understands both ParcPlace's
Smalltalk-80 and
Digitalks Smalltalk/V formats.
To see the contents of the file, double-click on it
in the list. Also directories are changed in this way.
More info on the FileBrowser is found in the document
"using the FileBrowser".
If you are new to smalltalk,
start by learning how to use the non graphical basic classes.
- Try and understand the container classes
- Learn how to use the
SystemBrowser
- create and inspect instances of some classes
- 'talk' to these objects in the inspector
- place breakpoints on methods and see what happens when single stepping
- although there are lots of existing classes, create new collection classes
and play with them
For a rough overview of what is there, read
"basic classes overview".
Getting more used to the system, try creating views. Start by reusing
existing widgets and combine them into more complex ones.
There are many widgets ready for reuse - you better look whats there, before
hurrying to program your own ones.
Read and understand the coding examples found in the directories
"doc/coding"
and "clients/Demos"
.
Notes:
(*)
The command key is labelled different on some keyboards;
try ALT, CMD, META
or similar.
Copyright ) Claus Gittinger Development & Consulting, all rights reserved
(cg@ssw.de)