> Hi, thanks, I now have two working solutions and a lot more knowledge,
> although why Delphi was written this way I don't understand.
There are some reasons, why the VCL is working this way. Borland distiguishes
between 'Owner' and 'Parent' to make
the use of components more flexible. The 'Owner' is responsible for freeing his
owned objects, thus starting a (wanted) recursion with
the effect that *all* the memory used by a component becomes freed.
A 'Parent' controls the beavior of its 'Children', it does not (nessecarily)
own them, so if the 'Parent' 'Dies' (gets freed) the
'children' still can exist.
> in FormCreate: ACheck[i] := TCheckBox.Create(nil);
> in FormClose: ACheck[i].Free;
This is working, but the real advantage is, you may free any of your ' ACheck'
before.
And
I deeply suggest that you use FreeAndNil to avoid to free an object twice by
accident.
>
> There was thought that if you do ACheck[i] := TCheckBox.Create(P); then P
> has the responsibility to Free and gets messed if it can't because it was
> already freed. I tried creating with owner P and not freeing, hoping that
> P
> might Free for me. This does not work.
Believe me, it does work! Check with the debugger: set breakpoints in your
onDestroy events and you'll see. Do not forget to set
the onDestroy event after you createt your ACheck[anynumber].
Have fun
Bob
------------------------ Yahoo! Groups Sponsor --------------------~-->
<font face=arial size=-1><a
href="http://us.ard.yahoo.com/SIG=12hh37csr/M=362335.6886445.7839731.1510227/D=groups/S=1705115362:TM/Y=YAHOO/EXP=1122625838/A=2894361/R=0/SIG=13jmebhbo/*http://www.networkforgood.org/topics/education/digitaldivide/?source=YAHOO&cmpgn=GRP&RTP=http://groups.yahoo.com/">In
low income neighborhoods, 84% do not own computers. At Network for Good, help
bridge the Digital Divide!</a>.</font>
--------------------------------------------------------------------~->
-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/delphi-en/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/