 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
John Leavey Guest
|
Posted: Wed Jul 30, 2003 2:23 pm Post subject: Re: Forms and parent forms |
|
|
On Thu, 31 Jul 2003 00:07:10 +1000, "djc" <dj@c.com> wrote:
| Quote: | How do I make it so that when the parent form is destroyed, all child forms
are also destroyed?
Eg. if Form A creates Form B, and Form B then creates Form C, and then I
close Form B I would like Form C to also close.
|
So long as Form C has Form B as an owner then it will automatically be freed when Form B
is freed.
John Leavey
|
|
| Back to top |
|
 |
Ignacio Vazquez Guest
|
Posted: Wed Jul 30, 2003 2:24 pm Post subject: Re: Forms and parent forms |
|
|
"djc" <dj@c.com> wrote in message 3f27d127$1 (AT) newsgroups (DOT) borland.com...
| Quote: | How do I make it so that when the parent form is destroyed, all child
forms are also destroyed?
|
Pass the parent form to the constructor of the child forms.
Cheers,
Ignacio
--
Jesus is coming... EVERYONE LOOK BUSY!
|
|
| Back to top |
|
 |
djc Guest
|
Posted: Fri Aug 01, 2003 4:54 am Post subject: Re: Forms and parent forms |
|
|
It wasn't working until I did this, which makes sense since the form isn't
destroyed when you click Close.
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action:=caFree;
end;
--
djc
|
|
| Back to top |
|
 |
Alexander Nagumanov Guest
|
Posted: Fri Aug 01, 2003 4:58 am Post subject: Re: Forms and parent forms |
|
|
| Quote: | I then create a child form (lets call it form B), and then I click the
button form B to create a child form (form C). If I then close form B,
form
C does not close.
|
Because form B just closing, not freeing.
Make this event handler:
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action:= caFree
end;
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|