On Wed, 22 Mar 2006, Darius Blaszijk wrote:

> ----- Original Message -----
> From: "Micha Nelissen" <[EMAIL PROTECTED]>
> To: <[email protected]>
> Sent: Tuesday, March 21, 2006 9:07 AM
> Subject: Re: [lazarus] TXMLPropertyStorage question
>
>
> > Felipe Monteiro de Carvalho wrote:
> >> "You can easily cope with this I think. Write an onclosequery (or
> >> onclose)
> >> handler for the main form. When the form closes, in the handler loop
> >> through
> >> Screen.Forms and call close on each form (except if it equals Self). This
> >> will trigger onclose in each form which is what you are after. In
> >> onclosequery for the main form dialogs are still functional so you'd be
> >> able
> >> ask the user. "
> >
> > Sounds like a hack from my POV. Where is the backward incompatibility
> > problem to delphi exactly when we fire OnClose when it's supposed to be
> > fired ?
>
> So how would I fire an onclose event when objects are created with no parent
> object (TForm.Create(nil))?

Simply call close ?

Procedure TParentForm.OnCLoseQuery(xyz);

begin
  MyChildForm.Close;
  Application.ProcessMessages; // Allow form to actually close...
end;

That should do the trick. Delphi also doesn't do do this automatically.
I create all actual forms on the fly, and dock them on other forms.
The parent form first closes all forms docked on it, and only then
allows to close itself.

Michael.

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to