Board index » delphi » CLOSE closes form but not application

CLOSE closes form but not application

I am using the CLOSE method, but under certain conditions it doesn't
execute the commands in the OnClose event and it only closes the form
without closing the application.  I can restore the application and
use the program.  Can anyone explain this behavior?
 

Re:CLOSE closes form but not application


Quote
> I am using the CLOSE method, but under certain conditions it doesn't
> execute the commands in the OnClose event and it only closes the form
> without closing the application.  I can restore the application and
> use the program.  Can anyone explain this behavior?

Try using:

Application.Terminate in the Close handler..

----
RKR

****************************************
E-Mail:  r...@primenet.com
****************************************

Re:CLOSE closes form but not application


Thus spake mrw...@winternet.com (Howard Abraham):

Quote
>I am using the CLOSE method, but under certain conditions it doesn't
>execute the commands in the OnClose event and it only closes the form
>without closing the application.  I can restore the application and
>use the program.  Can anyone explain this behavior?

Example code would be useful. Just pulling things out of the
air, I'd try Application.Terminate instead of Form.Close.
Other possibilities are Action := caFree in the OnClose
event handler. Probably others, but it's hard to know
without sample code.

Re:CLOSE closes form but not application


Quote
Howard Abraham wrote:

> I am using the CLOSE method, but under certain conditions it doesn't
> execute the commands in the OnClose event and it only closes the form
> without closing the application.  I can restore the application and
> use the program.  Can anyone explain this behavior?try

halt
--
==========================================
ke...@solar.csie.ntu.edu.tw
==========================================

Re:CLOSE closes form but not application


In article <316F252D.6...@solar.csie.ntu.edu.tw>, Kevin Kaitse Huang
<ke...@solar.csie.ntu.edu.tw> writes

Quote
>Howard Abraham wrote:

>> I am using the CLOSE method, but under certain conditions it doesn't
>> execute the commands in the OnClose event and it only closes the form
>> without closing the application.  I can restore the application and
>> use the program.  Can anyone explain this behavior?try
>halt

Trying HALT is not a good idea. According to at least one source, this
amounts to crashing your program in one line, and will *not* execute the
OnClose commands.

My only suggestion would be to make sure the Close command is applied to
the application's main window and not any child window or other control.
--
John Hudson, Gateshead, UK
_______________________________________________________

Re:CLOSE closes form but not application


Quote
>>> I am using the CLOSE method, but under certain conditions it doesn't
>>> execute the commands in the OnClose event and it only closes the form
>>> without closing the application.  I can restore the application and
>>> use the program.  Can anyone explain this behavior?
>>try halt
>Trying HALT is not a good idea. According to at least one source, this
>amounts to crashing your program in one line, and will *not* execute the
>OnClose commands.
>My only suggestion would be to make sure the Close command is applied to
>the application's main window and not any child window or other control.

Application.Terminate;

Other Threads