Re: Newbie question about release, freeAndNil, etc



Maarten Wiltink wrote:
>
> The forms should preferably register and unregister themselves
> with this list from the constructor and destructor, and be
> free-on-close so you don't go nuts juggling them. Basically,
> the single variable is replaced by a collection.

Does TCollection have some code that has that kind of free-on-close
property for Forms, or what is all that? I have never used TCollections,
I wonder if someone has code snippets how to use it with Forms.

A 'free-on-close' property for any Forms might be useful, but at least
my D6 version does not recognize it.

> however it's part of the pattern of "fire and forget" that the form
> should be defined to
> clean up after itself. The responsibility is not shifted just
> anywhere but to the (visual) object _itself_.

Just when I have learned the disciplided technics to always free all my
created Forms within the same program block where the Form was created:)
At the same time I abandoned the Release schema I had learned on the old
D1 days:

frmViewerOptions.showModal;
begin
//stuff
frmViewerOptions.release;
frmViewerOptions := nil;
end;

How is it, does the use of TCollection bring here some totally new, more
user friendly, "Java style", use-and-forget technique?
e.p
.