I always presumed the reason for that was because a pointer to the global 
form variable is left "dangling" and you will have no way to know if the app is 
still in memory or not (not to mention causing a GPF if you inadvertantly refer 
to after freeing). After freeing, you always want to set the form variable to 
nil so the "If Assigned" check will work. 
I.E.
Form1.free;
Form1 := nil;

Dave

--- On Tue, 11/18/08, Wilson, Stephen <[EMAIL PROTECTED]> wrote:
From: Wilson, Stephen <[EMAIL PROTECTED]>
Subject: RE: [delphi-en] Multiple instances of form
To: [email protected]
Date: Tuesday, November 18, 2008, 8:52 AM










    
            The disadvantage (for me, at least in this case) of calling Release 
is that it is not then possible to write anything in OnClose which, as shown by 
Doug's mail (thanks, Doug), doesn't get called.  Since Release is called in the 
Close event (thanks again, Doug), one can't Close and then Release.  So, I 
think you are right iin recommending OnClose + caFree, Dave and I will follow 
that in my app, but I don't understand the Delphi Help on TCustomForm. Release 
- "Any event handlers of the form should use Release instead of Free".



Cheers

Steve



-----Original Message-----

From: [EMAIL PROTECTED] ps.com [mailto:[EMAIL PROTECTED] ps.com]On

Behalf Of David Smith

Sent: 18 November 2008 15:40

To: [EMAIL PROTECTED] ps.com

Subject: RE: [delphi-en] Multiple instances of form



No, I was quoting the recommendations from the manual which I have followed 
religiously for years because they always work. That's what the OnClose event 
is for (It's go the action parameter for just that purpose). But go ahead and 
do what you want. Those debates seem utterly pointless to me when you can just 
look in the manual to see what it says.

 

Dave



-



************ ********* ********* ********* ********* ********* ********* 
*********

This e-mail and any files transmitted with it are confidential. If you are not 
the intended recipient, any reading, printing, storage, disclosure, copying or 
any other action taken in respect of this e-mail is prohibited and may be 
unlawful. If you are not the intended recipient, please notify the sender 
immediately by using the reply function and then permanently delete what you 
have received.

Content of emails received by this Trust will be subject to disclosure under 
the Freedom of Information Act 2000, subject to the specified exemptions, 
including the Data Protection Act 1998 and Caldicott Guardian principles.

This footnote also confirms that, unless otherwise stated, this email message 
has been swept by Sophos Anti-virus for the presence of computer viruses.

************ ********* ********* ********* ********* ********* ********* 
*********




      

    
    
        
         
        
        








        


        
        


      

[Non-text portions of this message have been removed]

Reply via email to