Back to Top

# Start a new project

First, start Pocket Smalltalk. You will get a small "launcher" window. From here you can access various components of the development environment. Your first task is to create a new project for your application. Projects are a way to organize the code for your application, and to keep code you write separate from code in the standard library.

When Pocket Smalltalk first starts up it has an "empty" project with only a few basic Smalltalk classes and no methods. In order to get a useful class library for application development you must install one or more packages. A package is simply a text file containing Smalltalk source code, and several such packages are included in the Pocket Smalltalk distribution.

You need to install two packages for this tutorial: core.st and forms.st. The core.st package contains the base Smalltalk class library (collections, numbers, and so forth), and the forms.st package contains a framework for PalmPilot applications.

To install these packages, open a Package Browser from the launcher window (use the Tools/Package Browser menu option). The package browser window has two panes. The top pane has a list of currently installed packages. Right now there are no packages installed, so the only thing listed here is (uncommitted), which is a special package that contains source code that does not belong to any other package.

The bottom pane of the Package Browser window lists the contents of the selected package. You can switch between viewing the classes, methods, and constants in the package using the three tabs in the middle of the window.

Select the Package/Install Package... menu option in the Package Browser. You will be prompted for the filename of the package to install. You first need to install the core.st package, which is located in the same directory as the Pocket Smalltalk executable. After selecting this file there will be a momentary pause as the package is compiled and installed. You will then see core.st appear in the list of packages, indicating that it has been successfully installed. You can click on the package name to view the classes defined by the package.

Now install the forms.st package in the same way: choose the Package/Install Package... menu option and select the forms.st package. You should now have both packages installed and visible in the Package Browser.

There is an important step you should perform at this point. The two packages you have loaded are now part of your current project. When you save your project the packages will be written to disk along with any changes you have made to them. For packages you create yourself, this is appropriate, but for "system" packages such as the two you just installed it is not. You can therefore tell the development environment to not save those packages along with your project. To do this, select one of the packages in the Package Browser and use the Package/Don't save with project menu option. Do this for both the core.st and forms.st packages.

Now you have your project set up to receive source code for the application you are about to write. But first, you need to create a package for yourself into which your new classes and methods will go. To do this, select the Package/New package... menu option in the Package Browser. Your new package will be called tutorial.st, so type that name into the file dialog box. You can place the new package in the Pocket Smalltalk directory, but to avoid clutter it is recommended that you create a new directory for each project.

After creating the new package, its name will appear in the Package Browser. Notice that the bottom status line in the Package Browser now indicates that your new package is the "default" package. This means that all new classes and methods you define will be put into your new package, which is what you want at this point.

Now you're ready to write an application! You should "save" your project now by selecting the System/Save project menu item in the Launcher window. Give it the filename tutorial.prj and put it in the same directory as your tutorial.st package.

Next Step: Using the Class Browser.
Back to Top