Multiple forms and the scope of the form variables

I am working on a project in Delphi 1.02 Developer.  The project is and
SDI "type" application in that the main form is really nothing much more
than a menu and a toolbar.  When the user chooses options from the menu or
toolbar, other windows are displayed in a modeless fashion.  This allows
the user to have several different windows open at the same time.  I also
have some forms that will display other forms when needed just as if the
user had chosen that particular option from the menu.

My problem is that I'm getting GPF's every now and then when I re-open a
window that was displayed previously but was closed.

Here's how I'm currently doing things:

I have a unit that has a single method called DisplayForm.  It takes as a
parameter a value that indicates which form to display.  It then checks to
see if the form is already created and creates the form if it is not.  It
then shows the form either by calling the Show method.  Each form has an
OnClose method that sets the Action variable to caFree.

So when I want to display a form, all I do is call:    

Here is some sample code that shows how the form are created and

unit Formshow;



  TClassFormType = (ftClients, ftStudents, ftClassdef, ftTuition,
ftTeachers, ftClastype, ftClasslvl);

function DisplayForm(ClassFormType: TClassFormType): Boolean;


   Clients, Students, Classdef, Tuition, Teachers, Clastype, Classlvl;

function DisplayForm(ClassFormType: TClassFormType): Boolean;
   case ClassFormType of
      ftClassdef: begin
                     if (frmClasses = nil) or (not
frmClasses.HandleAllocated) then
                        frmClasses := TfrmClasses.Create(Application);
                     if frmClasses.WindowState = wsMinimized then
                        frmClasses.WindowState := wsNormal;
                     Result := True;
      ftTuition:  begin
                     if (frmTuition = nil) or (not
frmTuition.HandleAllocated) then
                        frmTuition := TfrmTuition.Create(Application);
                     if frmTuition.WindowState = wsMinimized then
                        frmTuition.WindowState := wsNormal;
                     Result := True;
         Result := False;
end; {DisplayForm}


I'm not all that clear is this a scope issue or not.  I don't think it is
otherwise I wouldn't have been able to create the window the first time.
Also, I'm not sure if I should be creating these windows with Application
as the owner.  If not, then who should be?  I'm really at a loss to see
what the problem is here.  I hope some the guru's out here can help me!!!

Thanks in advance.

Scott Slater
Charter ClubWin Member