Board index » delphi » Closing First MDI Form Causes Errors

Closing First MDI Form Causes Errors

I have Delphi V5 and an MDI application that behaves unacceptably, but I
can't find the solution.

I let one MDI window be created at application startup (via CreateForm
in the project source).  Now I can create additional MDI children with
the command TMDIForm.Create(Self) in the MDI parent with success.
However, if I close the MDI child that was automatically created on
startup and try to create a new MDI form, I get an access error at
TMIDForm.Create(Self).  In the MDI OnClose event, I set the action to
caFree.  Now the oddity is that after the error, a new MDI form is
created.  I need help bad - I've lost more time to this issue than I can
to think about.

I have already tried removing the CreateForm from the project source,
allowing the MDI parent to create the first window, but I get the same
error when I try to create the first MDI child.

Greg

  Greg.Jackson.vcf
< 1K Download
 

Re:Closing First MDI Form Causes Errors


You are probably using the variable that is assigned to the first MDI child
form (see CreateForm) globally. This variable is only valid as long as the
first MDI child is not closed !
Secondly, if you create forms you should specify Application as the owner,
e.g. TMDIForm.Create(Application).

"Greg Jackson" <Greg.Jack...@noaa.gov> schreef in bericht
news:3A645676.69B7FF3@noaa.gov...

Quote
> I have Delphi V5 and an MDI application that behaves unacceptably, but I
> can't find the solution.

> I let one MDI window be created at application startup (via CreateForm
> in the project source).  Now I can create additional MDI children with
> the command TMDIForm.Create(Self) in the MDI parent with success.
> However, if I close the MDI child that was automatically created on
> startup and try to create a new MDI form, I get an access error at
> TMIDForm.Create(Self).  In the MDI OnClose event, I set the action to
> caFree.  Now the oddity is that after the error, a new MDI form is
> created.  I need help bad - I've lost more time to this issue than I can
> to think about.

> I have already tried removing the CreateForm from the project source,
> allowing the MDI parent to create the first window, but I get the same
> error when I try to create the first MDI child.

> Greg

Other Threads