๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.oodesign
Article #21

Re: Delete and null a no modal form

#21
From: Jose Manuel Tovar
Date: Wed, 23 Jun 2004 07:44
84 lines
2877 bytes
Hello Hans,

Thank for your quick response.


"Hans Galema" <dontusethis@dontusethis.nl> escribi๏ฟฝ en el mensaje
news:40d8820d@newsgroups.borland.com...
> Jose Manuel Tovar wrote:
>
> > 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".
>
> How many Form2's do you allow to exist simultanously ?

I have only one Form2 but I think that if I need more than one I only have
to define a new global variable where to store the objet, isn't it?

>
> > void __fastcall TForm1::btn_botonClick(TObject *Sender)
> > {
>     // To allow only one Form2
>      if ( ! Form2 )
>    Form2 = new TForm2(Application);
> // As Application is the Owner your
>          // Form will be deleted by TApplication
> // at programm end
>

How can I delete completely Form2 when the Form2 is closed by the user? I
mean that I would like to free the memory used by the form when the user
closes Form2.

I have to say that Form1 is always open so I'm afraid that using:



Form2 = new TForm2(Form1);



it is not the solution...



> >   Form2->Show();
> > }
>
>
> > void __fastcall TForm2::FormClose(TObject *Sender,
> >       TCloseAction &Action)
> > {
> >   Action = caFree;
>     // Ok
>
> > __fastcall TForm2::~TForm2()
> > {
> >   Form2 = 0;
>
> That is ok, provided you keep the caFree;
>
> > I think this is possible but what happens with all the windows standard
> > controls (labels, combos, etc ) defined in Form2?, are they destroyed
> > automatically?
>
> Yes. If the Form is destroyed the componets are destroyed too.
>
> > Thanks in advance,
>
> ??
>
> What kind of whitelineproducer do you happen to use ?
>

:)
The whitelineproducer is the famous MS Word with the invaluable
collaboration of the copy/paste command
.)

> Hans.

Thank you one more time.

Jose Manuel
Technical Details
Message-ID: <40d934e5$2@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!proxad.net!62.253.162.219.MISMATCH!news-out.ntli.net!newsrout1.ntli.net!news-in.ntli.net!ntli.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <40d85f31$1@newsgroups.borland.com> <40d8820d@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10db1e,113f95e7fbccde90
X-Google-Attributes: gid10db1e,public
From: "Jose Manuel Tovar" <jtovar@hrs-spiratube.com>
Newsgroups: borland.public.cppbuilder.oodesign
References: <40d85f31$1@newsgroups.borland.com> <40d8820d@newsgroups.borland.com>
Subject: Re: Delete and null a no modal form
Date: Wed, 23 Jun 2004 09:44:37 +0200
Lines: 86
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: <40d934e5$2@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1087976677 80.33.76.158 (23 Jun 2004 00:44:37 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!proxad.net!62.253.162.219.MISMATCH!news-out.ntli.net!newsrout1.ntli.net!news-in.ntli.net!ntli.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail