Previous Step: Using the Class Browser.
Back to Top

# Create a resource database

You will need to create a PalmOS resource database to hold user interface layouts, bitmaps, an application icon, the application's version ID, and so forth. This is not part of Pocket Smalltalk; you need to use external tools to do this. I recommend using PilRC for compiling resources and build-prc to link the resources into a resource database. It is assumed that you have these tools installed and can invoke them from the MS-DOS prompt.

The first step is to create a text file in your project's directory. If you do not have a good text editor you can use the Notepad program supplied with Microsoft Windows. Create a file named tutorial.rcp with the following contents:

    FORM ID 3000 AT (0 0 160 160)
    BEGIN
        TITLE "Smalltalk Tutorial"
        BUTTON "Push Me" ID 4000 AT (65 50 AUTO AUTO)
    END

This is PilRC syntax for a simple form layout. It specifies a form ID of 3000, and the form contains a title and a single button with an ID of 4000. You will use these ID numbers later to create bindings to these PalmOS user interface elements from Smalltalk.

Compile the file you just created with PilRC by typing the following at the MS-DOS prompt (in the same directory as the file you just created):

    pilrc tutorial.rcp

This should yield a file named tFRM0bb8.bin. If you had put more than one form definition in the .rcp file this would have produced more than one .bin file. The next step is to link the .bin file into a resource database. You do this using the build-prc tool. Type at the command line:

    build-prc tut_rc.prc "Tutorial Resources" STrc *.bin

This creates a resource database named tut_rc.prc containing the form resource you defined. If you make changes to the .rcp file containing your form definition(s), you must repeat these steps, so it may be helpful to create a batch file containing the above two commands (another useful step is to delete all the .bin files after the resource database is created; this ensures that out-of-date .bin files are not incorporated into your resource database after you remove a form or other resource from your .rcp file.

Next Step: Add resource databases to your project.
Back to Top