BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Form Close

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development)
View previous topic :: View next topic  
Author Message
Andrés de la Cuadra
Guest





PostPosted: Thu Feb 01, 2007 4:22 am    Post subject: Form Close Reply with quote



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





PostPosted: Thu Feb 01, 2007 7:15 am    Post subject: Re: Form Close Reply with quote



"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





PostPosted: Thu Feb 01, 2007 9:11 am    Post subject: Re: Form Close Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.