BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Re: Forms and parent forms

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Using
View previous topic :: View next topic  
Author Message
John Leavey
Guest





PostPosted: Wed Jul 30, 2003 2:23 pm    Post subject: Re: Forms and parent forms Reply with quote



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





PostPosted: Wed Jul 30, 2003 2:24 pm    Post subject: Re: Forms and parent forms Reply with quote



"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





PostPosted: Fri Aug 01, 2003 4:54 am    Post subject: Re: Forms and parent forms Reply with quote



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





PostPosted: Fri Aug 01, 2003 4:58 am    Post subject: Re: Forms and parent forms Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Using All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.