Tutorial step 1
===============


The file step1.cc contains almost the simplest possible program using the 
tws library. It has a window holding the main menu for a program and nothing
more.

Use the following command line to compile this step:
   
   gcc -o step1.exe step1.cc -ltws -lgr

To exit the program you must use Ctrl+Brk as the routines to handle the
menu selections have yet to be added.



-----------------


The next step is to add in a handler for the File|Exit menu option so that
the program can be exited.

When a menu item is selected the class for the menu recieves an event which
tells it which item was selected. To handle these events the 
DECLARE_RESPONSE_TABLE macro needs to be added to the protected section of 
the MainMenu class declaration, along with a function which will be called
for the event.
The class declaration should now look like this:

class MainMenu:public AutoMenu {
   public:
      MainMenu(Window *parent,int x,int y,int w)
         :AutoMenu(parent,MainMenuRes,1,x,y,w)
         {};

   protected:

      void CmFileExit();

      DECLARE_RESPONSE_TABLE;
};

This adds a function which will be setup as the handler for the event, and
the macro sets up the functions needed for response tables.

The event table now has to be setup to tell the class to call CmFileExit
when it receives the right event. The event table needs to be added anywhere
in your source file like so:

DEFINE_RESPONSE_TABLE(MainMenu,AutoMenu)
   E_COMMAND(ID_FILE_EXIT,CmFileExit)
END_RESPONSE_TABLE

This tells class MainMenu (derived from class AutoMenu) to call the member
function CmFileExit when it recieves a command event from the menu item with
ControlID ID_FILE_EXIT. This ID number is defined in the header file.

Now the function needs to be written. To exit from a program all that needs
to be done is to stop the event processing loop, so:

void
MainMenu::CmFileExit()
{
   ws.StopProcessingEvents();
}

Will stop the program. (This actually means the the call to ws.RunEvents() 
in the main() function will return).

Now you should have something resembling step2.cc and step2.h

On to step2...


