Search Locate Previous Next Contents

How to Design a ‘Main’ Application

This is the end-product of the first few sections of the tutorial. It is a small contact manager, with menu and toolbar, a list box of current contacts, and a pop-up incident log implemented as a Dyalog grid. It also has all the ‘correct’ Windows file-management behaviour and keeps a list of the recently used files. It will take 4–5 hours to work through these examples, but by the end of the process you will have learned most of what there is to know about Causeway!

As before, let’s start with some test data, but this time it is worth setting up a function to build it as we will need this soon enough to run from File, New on the main menu:

     ’ NEWFILE
[1]   © Do what we need to clear data down
[2]    ‘names„,›'Noname'
[3]    ‘addrs„,›'House' 'Street' 'Town' 'PostCode'
[4]    ‘eyes„,1
[5]    ‘log„,›0 2½0 ''
[6]    ‘was„‘names ‘addrs ‘eyes ‘log
     ’

This avoids the annoying empty case by setting up one row of dummy data to start with. It takes a snapshot of the data it made so that the application can prompt on exit if any data has changed.

Building the basic form definition is much as before, but there are one or two new tricks to look out for. The data for the Name field will now be indexed from the vector of names:


... where inx is set as the data of the list box to its left.

You can make inx a local variable on the form, and initialise it to 1 when the form is created. To localise it, simply add it to the locals list in the property watcher; and set it on creation in the event table for the main form (right mouse menu – Behaviour on the form itself):


There is one other entry in this grid which needs to be explained:

For the moment, just localise inx by adding it to the ‘locals’ property of the form, and add the second line to your table to initialise it – we can sort out the icon later!



Continue to: Writing the Application Code
© Copyright Causeway Graphical Systems Ltd 2001