Tutorial step 2
===============


The file step2.cc contains adds to step1 the functionality to handle events
from the menu. This shows the use of event response tables.

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

To exit the program you can now use the File|Exit menu selection that you
just added.



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



The next step is to create a window which we'll use later. Firstly add in a 
menu item to the File menu. This is done by adding the item to the 
FileMenuRes array. Make this new item File|New as this will open our window
for us, and define the constant ID_FILE_NEW for it.

Now the class for the window needs to be created. In the header file add a
new class declaration for a class DrawWindow derived publicly from class
Window. The constructor need only take the four coords for the rectangle.
It should look like this:

   DrawWindow(int x1,int y1,int x2,int y2)
      :Window(NULL,"Drawing Window",x1,y1,x2,y2,WA_VISABLE | WA_SAVEAREA | 
               WA_CAPTION | WA_SIZEABLE | WA_BORDER | WA_MAXBOX | WA_SYSBOX)
      {}

The call to the constructor for class Window has NULL for the parent. This
tells the window system to use the top window as the parent, and hence have
a free window. The style constants setup a window which is sizable, has a
caption, a maximize box and a system box.

Nothing else needs to be added to the class yet.

To handle the File|New menu item we will have to add another function exactly
like in the first step. In class MainMenu add the function CmFileNew in the
protected section. This function will open our new window. It should
allocate a new object of class DrawWindow and then paint it and refresh it:

{
   Window *temp=new DrawWindow(50,50,250,200);
   temp->Paint();
   temp->RefreshWindow();
}

Note that the object is not freed before the function exits. At present there is
actually no way to close the window either, this will be added later.


Now you should have some code that resembles step3.cc and step3.h
