Article View: borland.public.cppbuilder.oodesign
Article #24Re: Delete and null a no modal form
From: Hans Galema
Date: Thu, 24 Jun 2004 20:57
Date: Thu, 24 Jun 2004 20:57
40 lines
2251 bytes
2251 bytes
Jose Manuel Tovar wrote: > I'm afrais that I don't understand what you try to say. Why I need a > parameter that points to TForm2 if I can access to Form2 (the global > variable that points to TFrom2) in the TForm2 destructor and null it? You only need that if you open more instances of TForm2: >> 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? So then an instance has to know which pointer to null. > Could you give me short code example where I can see how to do what you > proposed? Before doing that I would like you to understand that if you have global: TForm2 *Form2A; TForm2 *Form2B; and Form2A = new TForm2 ( this ); Form2B = new TForm2 ( this ); That every instance of TForm2 has to know its global pointer in order to be able to null it. You can do that with an extra parameter, but it would be possible without too in the following way in the TForm2::OnClose(): if ( Form2A == this ) Form2A = NULL; if ( Form2B == this ) Form2B = NULL; Please do not quote entire posts. Hans.
Technical Details
Message-ID:
<40db3fe9@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news-hog.berkeley.edu!ucberkeley!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<40d85f31$1@newsgroups.borland.com> <40d8820d@newsgroups.borland.com> <40d934e5$2@newsgroups.borland.com> <40d9dd53@newsgroups.borland.com> <40dae59e@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10db1e,113f95e7fbccde90 X-Google-Attributes: gid10db1e,public Date: Thu, 24 Jun 2004 22:57:17 +0200 From: Hans Galema <dontusethis@dontusethis.nl> User-Agent: Mozilla Thunderbird 0.7 (Windows/20040616) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.oodesign Subject: Re: Delete and null a no modal form References: <40d85f31$1@newsgroups.borland.com> <40d8820d@newsgroups.borland.com> <40d934e5$2@newsgroups.borland.com> <40d9dd53@newsgroups.borland.com> <40dae59e@newsgroups.borland.com> In-Reply-To: <40dae59e@newsgroups.borland.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 129.125.201.248 Message-ID: <40db3fe9@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1088110569 129.125.201.248 (24 Jun 2004 13:56:09 -0700) Lines: 41 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news-hog.berkeley.edu!ucberkeley!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail