Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Release vs. FreeAndNil

202 views
Skip to first unread message

BobRoyAce

unread,
Mar 31, 2002, 11:20:55 PM3/31/02
to
Up until now, when I create a form, and subsequently free it, I use code
like follows:

frmTest := TfrmTest.Create(nil);
try
frmTest.ShowModal;

DoStuffHere...

finally
FreeAndNil(frmTest);
end; (* try...finally *)

I was reading something somewhere about the Release method for forms and it
got me to wondering if I should be doing that instead (e.g.
frmTest.Release). I must say that, as far as I know, all works fine doing
what I'm doing, but maybe that's just dumb luck.

Any insight?


Jeff Overcash (TeamB)

unread,
Mar 31, 2002, 11:46:25 PM3/31/02
to
RElease is to be called when you want to free a form from within an event of
that form. Release posts a message to the form so it won't get processed until
after return from the method. Trying to free a form from within say an OnClick
event will cause an AV, calling Release will not. If you are freeing from
outside the context of the form then Free is the correct way to do it.

--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
This sad little lizard told me that he was a brontosaurus on his mother's
side. I did not laugh; people who boast of ancestry often have little else
to sustain them. Humoring them costs nothing and adds to happiness in
a world in which happiness is in short supply. (RAH)

Shannon Broskie

unread,
Apr 1, 2002, 11:25:20 AM4/1/02
to
Too bad TFrames do not have some type of release features. In some cases
it'd be nice to have although for pretty much all of them, some upfront
design work can get around it.

"Jeff Overcash (TeamB)" <jeffov...@mindspring.com> wrote in message
news:3CA7E621...@mindspring.com...

Dave Nottage (TeamB)

unread,
Apr 1, 2002, 8:50:20 PM4/1/02
to
"Shannon Broskie" wrote:
> Too bad TFrames do not have some type of release features. In some
cases
> it'd be nice to have although for pretty much all of them, some
upfront
> design work can get around it.

You could report your request to QualityCentral:

http://wwwapp1.borland.com/qc/

--
Dave Nottage (TeamB)


Constantine Yannakopoulos

unread,
Apr 2, 2002, 3:27:38 AM4/2/02
to
> Too bad TFrames do not have some type of release features. In some
cases
> it'd be nice to have although for pretty much all of them, some
upfront
> design work can get around it.

Well, i think it is very easy to add a Release in your frame. All you
have to do is copy procedure Release and message handler CMRelease
from TCustomForm in your frame.


Manuel Algora

unread,
Apr 2, 2002, 10:54:07 AM4/2/02
to
On Tue, 2 Apr 2002 11:27:38 +0300, "Constantine Yannakopoulos"
<ky...@singular.gr> wrote:

>Well, i think it is very easy to add a Release in your frame. All you
>have to do is copy procedure Release and message handler CMRelease
>from TCustomForm in your frame.

And may be ask this to be added already to TFrame for Delphi 7.

Manuel Algora
cen...@wanadoo.es

0 new messages