Hi All,I was under the impression that the reason for releasing a Form
rather than freeing it was to ensure that any messages that had been
posted to the form are handled before the form was destroyed.Just my 2d
(2p) worth ;-)Paul Bennett.
----- Original Message -----

  From: "David Smith"

  To: [email protected]

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

Date: Tue, 18 Nov 2008 10:26:54 -0800 (PST)

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


Experience is something you don't get until just after you need it. 

-- 
_______________________________________________
Surf the Web in a faster, safer and easier way:
Download Opera 9 at http://www.opera.com

Powered by Outblaze


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

Reply via email to