# Setting Up The Packages

> The application we will be building in this tutorial is a simple program, but it demonstrates several of the Palm OS widgets. It is simple, but it actually does something. It is called "ManHourCalculator", and computes the number of man-hours a project will "really" take. It is an amusing program that I think will be fun to build, and will help you on your way with PST.

> The first step after getting the tools installed is to startup the Pocket Smalltalk system. Either run the `pocketst.exe` program from a command line, or create a Windows shortcut on your Start menu, and click on that. You should see a window that looks like this

> This is the main "control center", or "launcher", for the PST system. When you start PST, you are "in" an as-yet-unnamed project. Let's begin by saving it with a name. Click on the `System` menu, then `Save project as...`, navigate to the location where you want to keep this project, and name the project file `ManHourCalculator.prj`. (Henceforth I will use a kind of shorthand for menu commands. The above command would be written as `System -> Save project as...`.)

> Now that you've saved the project, we need to add the system packages that we will be using. These packages contain the core Smalltalk classes, as well as the classes that bind to the Palm OS graphic widgets. There are also packages for date/time manipulation and Palm OS database access, but these will be covered in a later tutorial. To open the Package Browser, click on the menu item `Tools -> Package browser`. This should present you with a window that looks like this

> This tool allows you to import packages of Smalltalk code into your project. There are two packages that we will be including in our project, `core.st` and `forms.st`. To include them, click on `Package -> Install package...`. You will be presented with a standard Windows file selector. The two packages we want are installed in the top-level directory of Pocket Smalltalk (on my system, this is C:\PocketSmalltalk). First double-click on `core.st`. After a few seconds, while the code in the package is being compiled, the browser should be updated, with "core.st" showing up in the top window. Repeat these steps for `forms.st`. After both of these packages have been loaded, we need to tell the system not to update them when we save our project. This is so that changes you make won't propagate to future projects; each project should start off clean. To make this change, right-click on core.st, and select `Don't save with project`. Do the same thing with forms.st.

> We now need to create a package for all of our code to go in. To do this, click on `Package -> New package...`. You will be presented with a standard Windows save file dialog. Navigate to your project folder and type `ManHourCalculator.st` in the "File name" text field, and click "Save." You should notice that in the browser's status bar it says "Default: ManHourCalculator.st", or whatever you called your package. This means that any new code you write, or constants you define, will be placed in this package automatically.

> Note: For some odd reason, version 1.5 of Pocket Smalltalk does not retain the default package setting between invocations. You must remember to re-set the default package to your "ManHourCalculator.st" package each time you start PST. To do this, open the package browser, right-click on your package, and select "Set as default" from the context menu. Failure to do this will result in methods being "lost" between sessions.

> Now is a good time to save your project again. Close the package browser and then click on `System -> Save project` on the launcher. It is a good idea to save your project frequently to prevent loss of work.

> << Section 0: Overview of Pocket Smalltalk | Section 2: Creating The Resources >>
> Introduction

Copyright © 2000 Joey Gibson