Article View: borland.public.cppbuilder.oodesign
Article #19Delete and null a no modal form
From: Jose Manuel Tovar
Date: Tue, 22 Jun 2004 16:33
Date: Tue, 22 Jun 2004 16:33
104 lines
2228 bytes
2228 bytes
Hello everybody,
I have a doubt:
I have a main form (Form1) and when I press a button I create a new no modal
form (Form2). In order to destroy Form2 I use "caFree".
void __fastcall TForm1::btn_botonClick(TObject *Sender)
{
Form2 = new TForm2(Application);
Form2->Show();
}
//--------------------------------------------------------------------------
-
void __fastcall TForm2::FormClose(TObject *Sender,
TCloseAction &Action)
{
Action = caFree;
}
//--------------------------------------------------------------------------
-
(Form2 is a global variable)
And I suppose that this is equivalent to (talking about freeing memory):
delete Form2;
But I would need something like (talking about nullify the pointer):
Form2 = 0;
to do something like checking the existence of the form "if (Form2) .", etc.
and that is not done using "caFree".
Can I do?
__fastcall TForm2::~TForm2()
{
Form2 = 0;
}
//--------------------------------------------------------------------------
-
I think this is possible but what happens with all the windows standard
controls (labels, combos, etc ) defined in Form2?, are they destroyed
automatically?
Or if this is not possible, how could I delete no modal forms and null them?
Thanks in advance,
Jos� Manuel Tovar
Technical Details
Message-ID:
<40d85f31$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 10db1e,113f95e7fbccde90,start X-Google-Attributes: gid10db1e,public From: "Jose Manuel Tovar" <jtovar@hrs-spiratube.com> Newsgroups: borland.public.cppbuilder.oodesign Subject: Delete and null a no modal form Date: Tue, 22 Jun 2004 18:33:06 +0200 Lines: 107 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 80.33.76.158 Message-ID: <40d85f31$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1087921969 80.33.76.158 (22 Jun 2004 09:32:49 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail