Just tried it quickly to make sure I still get the error.

In the OnClose event, I put in code to free the dialog as follows:

   frmGlobalPointer := NIL;
   Self.Free;

The free seems to work until it gets to the processing code that
called the OnClose (i.e. the button press or mouse click that called
it.)  At that point, an "Abstract Error" is triggered.  This makes
sense - the OnClose is called by a mouse or key event which need to
finish after the OnClose event ends.  Having freed the form, the
control is no longer there to finish up.  That has always been the
problem that I have run into.

jamie

--- In [email protected], "Jamie L. Mitchell" <[EMAIL PROTECTED]> wrote:
>
> Hmmmm- interesting.  The MastApp that comes with Delphi 2005 appears
> to be different.  All forms are created at start time - a grep search
> of the files show that they do not do that anywhere.  Same with the
> IPMastApp.
> 
> jamie
> 
> --- In [email protected], David Smith <djsmith_1998@> wrote:
> >
> > Straight out of the Delphi manual (the application
> > creates a global variable automatically as the form's
> > name when you create a new form):
> > 
> > 
> > Put this in the form's OnClose event:
> >    MyForm.Free;
> >    MyForm := nil;
> > 
> > To create it (from anywhere):
> > 
> >   If MyForm <> nil Then 
> > MyForm := TMyForm.Create(mainForm)
> > 
> >  (I always make the mainform the owner unless it's got
> > an obvious child relationship to something else, that
> > way it always gets freed during a GPF situation)
> > 
> >   If you create more than one, you can make sure
> > you've freed them all by iterating through the
> > Screen.Forms variable looking for that class type:
> > 
> > For i := 0 to Screen.Forms.count-1 do
> >   If Screen.Forms[i] is TMyform then MyForm.close;
> > 
> >    See the demo's example under the folder:
> > demos/db/MastApp. In fact, that application has an
> > example of many useful tips to use in your own app.
> > 
> > Dave
>


Reply via email to