 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Andrés de la Cuadra Guest
|
Posted: Thu Feb 01, 2007 4:22 am Post subject: Form Close |
|
|
I put some code inside OnClose event in the main form.
The code Action = caFree works fine when the form was closed by
the user, but it doesn't finish when the form was closed using
Close(); inside the program.
In both cases the event is called, but in the second case it does
not end the program until the user close it clicking in the
upper right corner of the window.
Any idea? |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Thu Feb 01, 2007 7:15 am Post subject: Re: Form Close |
|
|
"Andrés de la Cuadra" <andres (AT) adelacu (DOT) com> wrote in message
news:45c116a0$1 (AT) newsgroups (DOT) borland.com...
| Quote: | I put some code inside OnClose event in the main form.
|
This is not a component writing issue. Your question should have been
directed to a more appropriate newsgroup.
| Quote: | The code Action = caFree works fine when the form was
closed by the user, but it doesn't finish when the form was
closed using Close(); inside the program.
|
Yes, it does. What you are not taking into account is that caFree is
NOT an immediate destruction of the form. It posts a CM_RELEASE
message to the main message queue. The form is freed when the message
is processed later on.
| Quote: | In both cases the event is called, but in the second case it
does not end the program
|
Yes, it will. the program ends when the MainForm is closed for any
reason.
In any case, if you want to ensure that the program ends, you should
be calling Application->Terminate() instead of Close().
| Quote: | until the user close it clicking in the upper right corner of the
window. |
All that does is causes Close() to be called like any other call.
Gambit |
|
| Back to top |
|
 |
Hans Galema Guest
|
Posted: Thu Feb 01, 2007 9:11 am Post subject: Re: Form Close |
|
|
Andrés de la Cuadra wrote:
| Quote: | I put some code inside OnClose event in the main form.
The code Action = caFree
|
For a mainform that is not necessary as it will be cleaned up
automatically.
Hans. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|