Creating the application files

The first thing to create is the application directory !TbxMin. Once created all other files are created under this.

All Toolbox applications need a messages file with two special tags in. Create a file called Messages with the following contents.

_TaskName:Minimun TBX application
_TaskSprite:!tbxmin

Next we want to give the application an icon in the filer view and one to use on the iconbar when the application is run. To do this we create a sprite file !Sprites that contains a single mode 12 sprite sized 34x17 named !tbxmin. This sprite can be created with !Paint.

All the GUI objects used in the application are defined in the resource file. Using !ResEdit create a new resource file Res as follows:

  1. Add an iconbar icon.
  2. Set its auto create and show object flags.
  3. Edit the iconbar icon definition so that it's sprite is set to "!tbxmin" and it has a menu named "IBMenu".
  4. Add a menu and rename it to "IBMenu".
  5. Add a menu item with the text "Info" that shows the object "ProgInfo" as a submenu.
  6. Add a menu item with the text "Quit" that raises the event &82a91. When the tbx application receives this event number it knows it must quit.
  7. Finally add a proginfo dialogue.

We also need to create an obey file !Run to ensure the Toolbox modules are loaded and launch the application. Create the !Run with the following contents.

| Run file for TbxMin application                                        1

RMEnsure Toolbox 1.36 RMLoad System:Modules.Toolbox.Toolbox              2
RMEnsure Toolbox 1.36 Error This application needs Toolbox 1.36 or later.
RMEnsure IconBar 0.00 RMLoad System:Modules.Toolbox.IconBar              3
RMEnsure IconBar 1.12 Error This application needs IconBar 1.12 or later.
RMEnsure Menu 0.00 RMLoad System:Modules.Toolbox.Menu
RMEnsure Menu 0.24 Error This application needs Menu 0.24 or later.
RMEnsure ProgInfo 0.00 RMLoad System:Modules.Toolbox.ProgInfo
RMEnsure ProgInfo 0.09 Error This application needs ProgInfo 0.09 or later.

Wimpslot -min 2048K -max 2048K                                           4

Set TbxMin$Dir <Obey$Dir>                                                5

Run <TbxMin$Dir>.!RunImage %*0                                           6

1

This is a comment line that is ignored when the file is run.

2

All Toolbox applications must ensure the toolbox modules is loaded. The first line loads it if it is not already loaded and the second line checks the version is high enough for this application and reports an error and stops if it is not.

3

The other toolbox modules needed by the application are loaded here.

4

Set the initial size the application requires. C++ programs compiled with GCC will grow the wimpslot as they run if necessary, but you still need enough space allocated to start the program up. The value chosen here "2048" is just a guess it will need to be adjusted (probably to a smaller value) once we have the application finished.

5

This command sets a system variable with the location of this application. It is used so the application knows where to load it resources.

6

This is the line the launches the application.