Article View: borland.public.delphi.winforms.controls.using
Article #514Problems with 2 instances of the same form.
From: Paul
Date: Thu, 19 Aug 2004 08:44
Date: Thu, 19 Aug 2004 08:44
39 lines
2109 bytes
2109 bytes
Not sure if this is the right forum, but I am writing a CRM application and
have a form which can create a new version of itself, which can in turn call
a new version of itself and so on.
The Activity form is created at runtime e.g.
Function TActivityForm.ShowForm : integer;
Try
ActivityForm := TActivityForm.Create(nil);
With ActivityForm do begin
SetStuff;
ShowModal;
Result := ActivityID
end;
Finally
ActivityForm.Free;
End;
End;
This form can then create another instance of the Activity form e.g.
FollowUpID := ShowForm;
The problem is that when the 2nd instance of the Activity Form is freed and
control returns to 1st instance of the Activity Form, the 1st instance of
the form is no longer accessible i.e. the instance of the form shows a null
value as its name e.g.
ShowMessage(ActivityForm.Name); //This shows "ActivityForm"
FollowUpID := ShowForm;
ShowMessage(ActivityForm.Name); //This shows ""
and any attempt to access components on the form result in an access
violation.
Any ideas?
Many thanks in advance.
Paul.
Technical Details
Message-ID:
<41246978@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 1eff29,767fa88ec44a774a,start X-Google-Attributes: gid1eff29,public X-Google-Language: ENGLISH,ASCII-7-bit Reply-To: "Paul" <paul.carter@sovereignhealthcare.co.uk> From: "Paul" <paul.carter@sovereignhealthcare.co.uk> Newsgroups: borland.public.delphi.winforms.controls.using Subject: Problems with 2 instances of the same form. Date: Thu, 19 Aug 2004 09:44:00 +0100 Lines: 41 Organization: Sovereign X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 82.69.34.4 Message-ID: <41246978@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1092905336 82.69.34.4 (19 Aug 2004 01:48:56 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail