Smalltalk/Squeak Basics - System Browser

(Material provided by Rodney Walker at Georgia Tech)


In part 2 of our intro to Smalltalk and Squeak, we'll be looking at how we use the system browser to do more work, save/edit our code, and manage our classes. Part 1 of the basics can be found by clicking here.

As with our previous work, we need to open up a system browser first. Left click on the background, hold the button down, select "open", and select "browser". A green window labeled "System Browser" should appear. The window should look like this:

Note: My browser window looks different. Just like other environments, you can change the preferences in this one as well. You can check other options by left clicking in the system window and choosing 'help', and then choosing 'preferences'. A window will pop up, and you can click on true/false to toggle the selection.


The top half contains (or will contain) all of the class information in this image of Squeak. This contains everything needed not only for Smalltalk, but also the Squeak environment itself. It is organized as shown below:

The bottom half contains all of the code and other text for the classes. We'll step through an example to show how it changes.


If we click on a class category in the leftmost pane, then on the bottom we should see code that looks like this:

Object subclass: #NameOfClass
	instanceVariableNames: 'instVarName1 instVarName2'
	classVariableNames: 'ClassVarName1 ClassVarName2'
	poolDictionaries: ''
	category: 'Music-Scores'
This is what the various pieces are here. Make a note that at this stage, everything shown will be default values. When we start making our own classes, this is where we will always want to begin:


Clicking on a class in the left-center pane should bring up something similar in the bottom pane:

AlignmentMorph subclass: #ScorePlayerMorph
	instanceVariableNames: 'scorePlayer trackInstNames 
instrumentSelector scrollSlider pianoRoll playOrPause scoreTitle '
	classVariableNames: 'LastMIDIPort '
	poolDictionaries: ''
	category: 'Music-Scores'
As you can see, it follows the same format as the previous section. The difference here is that the values shown are specifically for the class and are not defaults. In this case, take note that the parent class is AlignmentMorph and not Object. Also notice that the number of instance and class variables is not bounded - it can be any number greater than 0.

In most cases, you won't be making any major changes to classes which are already in the image. However, if you do, this would be where you start. This is where you would start/continue working on a class you have done.


Clicking on a class method category in the right-center pane should bring up something looking like this:

message selector and argument names
	"comment stating purpose of message"

	| temporary variable names |
	statements
Again as with our first example, these are default values. They mean the following:


Our last example comes from clicking on a particular method. In this case, I'm chosing a different method which incorporates all of the elements shown above:

onScorePlayer: aScorePlayer title: scoreName 

	"This method takes in a scorePlayer and the file name"
        "It then sets up the controls in the scorePlayerMorph"

	| divider col volRow rateRow scrollRow rateRow1 volRow1 
scrollRow1 pianoRow rightCol leftCol r |

	scorePlayer _ aScorePlayer.
	scoreTitle _ scoreName.
This time, the various lines have values in them:


For more help, you can go on to step 3 of our little tutorial on Squeak basics. This has to deal with menu basics. You can also find out about the menus we can use with the browser by going to the browser menus page.