Help - Help on Help - How to use Squeak Help
Previous - Help on Help - Next
- Three ways of using Squeak Help
- How to tweak Scamper's look
- Setting up a Squeak Help project
- Important keyboard shortcuts
- Examples of code
- Examples for browsers
- Examples for inspectors
Two ways of using Squeak Help
There are three perfectly good ways to use Squeak Help to learn more about Squeak
(1) read Squeak Help in any webbrowser outside Squeak (it will not run the code in the text)
(2) read Squeak Help inside Squeak in Scamper, which is Squeak's webbrowser (Squeak will run the code in the text)
(3) do both of the above: A standard webbrowser is faster - and it provides an extra layer with explanations.
You can read all of Squeak Help inside Squeak by using Scamper (which therefore must be part of the image you want to read Comments or Help in). This is the recommended use of Squeak Help. The advantage of reading it in Scamper in Squeak is that then all programming code - in magenta - in the files will run in Squeak. If you download and use Squeak 3.7 Scamper is included.
If you have not installed Squeak - or only want to read Squeak Help in an ordinary webbrowser - you can read all of Squeak Help in any ordinary webbrowser. The setback of not reading it inside Squeak is that all programming code in the files will not run in any ordinary webbrowser.
What it should look like:
Here is a gif-picture made in Squeak of the present part of this Help inside Squeak inside Scamper
In the Squeak you are running it may look a bit different, but it will be recognizable.
Squeak Help is meant to help you with understanding and working with Squeak. You can read it through, and if you run it in Squeak you can browse the code in it, that is often made magenta to make it recognizable code, and also browse such terms as Squeak can show in a browser.
Here are some examples, with explanations.
How to tweak Scamper's look
- You can change the color of Scamper's containing window by means of its window-menu
- You can change the color of any windows using Worldmenu - appearance - windowcolors
- You can copy any Scamper and any morph by means of the upper right halo
These simple options assure that you can have many Scampers with different parts of Squeak Help on your screen in the color you want. (The color-changer you get will stay on screen if you click on the dot on it. You can also reset modalColorPickers in Preferences-general.)
Having several Scampers with Squeak Help open on several parts probably is helpful.
If you don't like the fonts Squeak comes with to start with, try Assorted Initial Remarks, under Font issues.
Setting up a Squeak Help project
Squeak is very powerful, and to use its powers one needs to learn about it. A convenient way to do so (if you are new to Squeak) is- to have a project in your Squeak image dedicated to Squeak Help
Making a project:
Use Worldmenu - projects... - create new morphic project. This creates a project-button in the project you are working, which when clicked allows you to enter it. If you call it 'My Squeak Help' you know what it is for, and you can study Squeak Help in it, add your own notes in Workspaces, and have your own help materials conveniently gathered at one place.
Download a number of pdf-books and html-files:
See Useful Internet Links. Especially Stéphane Ducasse's site (http://www.iam.unibe.ch/~ducasse/WebPages/FreeBooks.html) that contains more than 10 complete books dedicated to several versions of Smalltalk is very helpful. (My own favourites on that website are Inside Smalltalk by Wilf Lalonde and John Pugh, and The Art and Science of Smalltalk by Simon Lewis).
And there is a fine book about Squeak available here: http://coweb.cc.gatech.edu/squeakbook/35 that gives you a lot of background on many aspects of Squeak.
Important keyboard shortcuts
What is the Cmd (Command) key on Apple is the Alt key on Windows and Linux. There are many important keyboard shortcuts in Squeak.
Here are a few basic ones - and all do their stuff on highlighted magenta parts of text, nearly anywhere inside Squeak:
Cmd-d = Do It = process the text. Browser openBrowser
Cmd-p = Print It = Do It and print the result behind it. 5+4+3+2+1
Cmd-b = Browse It = start a browser on the object with the highlighted name. Project
Cmd-i = Inspect It = Do It and start an inspector on the result. #('One' 'Two' 'Three' 'Go') asSet.
Cmd-m = Make a collection of implementors of the term. collect:
Cmd-n = Make a collection of senders of the term. do:
Cmd-k = Start a new workspace (when the cursor is in the Project window, not on some morph inside it)
Cmd-t = Start a transcript (when the cursor is in the Project window, not on some morph inside it)
Cmd-. = Stop it = Cmd key followed by a dot ends whatever activity Squeak is busy with and returns to the state that was before that activity started. (Use this when you think something is wrong or takes too long.)
There are many more command-keys, notably in a Workspace. Here is a list of those that work in a workspace:
Utilities openCommandKeyHelp. "Select and Cmd-d pops them up. Also in Worldmenu-help."
Examples of code
Date today. "If you highlight this and do Cmd-p (Alt-p on Windows) Squeak will print today's date (according to the system clock. The p abbreviates: Print ".
The above comment was in quotes, so as not to confuse Squeak: Strings between quotes are code-comments in Squeak and skipped by Squeak.
(3/5)+(4/5). "If you highlight this and do Cmd-p you see Squeak can calculate fractions."
2 sin. "If you highlight this and do Cmd-p Squeak prints the sinus of 2."
Next, open a Transcript window (Cmd-t when the cursor is in the Project window), highlight the next three lines;
| sum |
sum := 2 sin+3 sin.
Transcript cr; cr; show: 'The sum is '; show: sum.
and do Cmd-d see what happens in the Transcript window. This code shows a cascade.
Highlight the following 6 lines and do Cmd-d ("d" is for DoIt):
| dict | "declare a variable"
dict := Dictionary new. "assign a new Dictionary to the variable"
dict add: 1->'One'. "add an Association to dict"
dict add: 'Two'->2. "add an Associaton to dict"
dict add: 'Sum'->'One + 2 = Three-ish'. "add an Associaton to dict"
dict inspect. "inspect dict"
This is code that introduces a variable 'dict', assigns it to a new Dictionary, adds three items, and opens an inspector on it that Squeak will pop-up with the dictionary you made. (Clicking x on it removes it.) The three items are added with Associations, which imitate arrows with the key of the dictionary left and its value right. Associations are a neat way of rapidly adding key->value pairs to a Dictionary.
Next, here are some simple examples of calculating using the transcript and blocks using a Transcript:
Transcript clear. "clears the transcript"
The following puts the powers of 2 up to 32 in the transcript. Select the next 5 lines and do Cmd-d:
| count power2 |
count := 0.
[ count < 33 ] whileTrue:
[power2 := 2 raisedTo: count. "Here the calculation gets done. Try Cmd-m on raisedTo: "
Transcript show: count; tab; tab; show: power2 ; cr. count _ count+1.]
And the following the number of different things that can be taken from 100 thing, in jumps of 5. Select the next 5 lines and do Cmd-d:
| count choice |
count := 0.
[ count < 101 ] whileTrue:
[choice := 100 take: count. "Here the calculation gets done. Try Cmd-m on take:"
Transcript show: count; tab; tab; show: choice ; cr. count := count+5.]
For more, see Workspaces and Programming.
Examples for browsers
Browser "If you highlight this and do Cmd-b (b is for BrowseIt) Squeak will start a system browser on Browser"
TextMorph "If you highlight this and do Cmd-b (b is for BrowseIt) Squeak will start a system browser on TextMorph"
NonsenseTerm "If you highlight this and do Cmd-b nothing happens, for Squeak has no 'NonsenseTerm' anywhere"
collect: "If you highlight this and do Cmd-m (m is for Method) Squeak will start a method browser on collect:"
do: "If you highlight this and do Cmd-n Squeak will start a method browser on do: "
The last two are especially useful once you start programming Squeak. Try both on the last two examples to find where a method of the given name is programmed and where it is used.
Examples for inspectors
'This is a piece of text.' "If you highligt this and do Cmd-i (i for Inspect) Squeak will start an inspector on it."
#('This' 'also' 'is' 'text') asSet. "If you highligt this and do Cmd-i, Squeak will start an inspector on it."
This is merely to show what is possible - and VERY MUCH more is possible.
For a little more see Workspaces, Programming and BrowsingSqueak.
Previous - Help on Help - Next