Board index » delphi » Form Close Not Firing

Form Close Not Firing

When I have multiple MDI Child windows open and I close my app using
the main form's "X" button in the upper right corner, the Form Close
event does not fire for any of the MDI Child forms - only the Query
Close events fire - how do I get the Form Close Action := caFree to
execute with these forms?

Thanks...

Ralph Freshour

 

Re:Form Close Not Firing


I think on Wed, 15 Jul 1998 02:05:55 GMT, Ralph Freshour said:

Quote
> When I have multiple MDI Child windows open and I close my app using
> the main form's "X" button in the upper right corner, the Form Close
> event does not fire for any of the MDI Child forms - only the Query
> Close events fire - how do I get the Form Close Action := caFree to
> execute with these forms?

> Thanks...

> Ralph Freshour

Have you tried putting it in the OnDestroy Event?

--
My Reality is a Figment of my Imagination

    ---Phase

Re:Form Close Not Firing


  Borland stated a while back you should never use Close Action :=
caFree....  Somewhere, there was a bug (I guess it works find in Delphi 3,
but I still wouldn't trust it...)

--
Jason Wallace
SL Software
Dark...@SLSoftware.reno.nv.us
--
"We are Microsoft.  You will be assimilated.  Resistance is Futile."
--

Quote
Ralph Freshour wrote in message <35ac0e6e.3690...@news.interserv.com>...
>When I have multiple MDI Child windows open and I close my app using
>the main form's "X" button in the upper right corner, the Form Close
>event does not fire for any of the MDI Child forms - only the Query
>Close events fire - how do I get the Form Close Action := caFree to
>execute with these forms?

>Thanks...

>Ralph Freshour

Re:Form Close Not Firing


Thats one of the reason that I now program MDI application with Delphi. I
have searched for a method like the one Centura and SQL Windows are using.
Centura solves it with a Windows Message "SendMessageToChildren" Witch send
a WM message to the MDI choldren it is then up to the MDI Child classes to
receive the messege and act op on it. Form instans
SendMEssageToCildren( Handle, APM_SaveFile, 0, 0 )" Send the message to the
MDI Children to save all MDI child. Like when you call "Save all" in Delphis
File menu.

Is there anybody who knows how to do this in Delphi?

Quote
Ralph Freshour wrote in message <35ac0e6e.3690...@news.interserv.com>...
>When I have multiple MDI Child windows open and I close my app using
>the main form's "X" button in the upper right corner, the Form Close
>event does not fire for any of the MDI Child forms - only the Query
>Close events fire - how do I get the Form Close Action := caFree to
>execute with these forms?

>Thanks...

>Ralph Freshour

Re:Form Close Not Firing


Lars,

Sending the message to each child window is easy - in the MDIFrame
window:

const
   APM_SaveFile = WM_USER + 100;

for i := 0 to MDIChildCount - 1 do
    PostMessage(MDIChild[i].Handle, APM_SaveFile, 0, 0);

In each child form:

const
   APM_SaveFile = WM_USER + 100;

type
   TYourMDIChild = class(TForm)
      protected
         procedure APMSaveFile(var Msg: TMsg); message APM_SaveFile;
   end;

In the implementation section:

procedure TYourMDIChild.APMSaveFile(var Msg: TMsg);
begin
    // Save the file here....
end;

Ken
--
Ken White
kwh...@westelcom.com

Clipper Functions for Delphi
http://members.aol.com/clipfunc/

Quote
Lars Rosenberg wrote:

> Thats one of the reason that I now program MDI application with Delphi. I
> have searched for a method like the one Centura and SQL Windows are using.
> Centura solves it with a Windows Message "SendMessageToChildren" Witch send
> a WM message to the MDI choldren it is then up to the MDI Child classes to
> receive the messege and act op on it. Form instans
> SendMEssageToCildren( Handle, APM_SaveFile, 0, 0 )" Send the message to the
> MDI Children to save all MDI child. Like when you call "Save all" in Delphis
> File menu.

> Is there anybody who knows how to do this in Delphi?

> Ralph Freshour wrote in message <35ac0e6e.3690...@news.interserv.com>...
> >When I have multiple MDI Child windows open and I close my app using
> >the main form's "X" button in the upper right corner, the Form Close
> >event does not fire for any of the MDI Child forms - only the Query
> >Close events fire - how do I get the Form Close Action := caFree to
> >execute with these forms?

> >Thanks...

> >Ralph Freshour

Other Threads