🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.winforms.controls.using
Article #4

Re: one form influencing another

#4
From: Wayne Niddery [TeamB]
Date: Tue, 12 Sep 2006 17:51
27 lines
2537 bytes
Brigitte Spatz wrote:
>
> No, I'm using FCL (at least that's what I think Winforms refers to).
> Cor, wasn't life easy when there was just one Delphi - LOL.

Ok. Then I assume that there is some action (e.g. a button or menu item) 
that is creating and displaying the second form. Therefore it is possible 
for you to pass a reference to the main form to this second form, and then 
the second form is free to call any public method or access public 
properties of the main form.

E.g. If the main form class is named TWinFom1 and the form you want to call 
Close_All from is TWinForm2, then:

- Add WinForm1 to the uses clause of WinForm2.
- Add a public field in TWinForm2 of type TWinForm1 (let's call it Form1: 
TWinForm1;)
- in the TWinForm1 procedure that creates and displays TWinForm2, after 
creating it, set its Form1 field to Self (Self will refer to the TWinForm1 
instance that is running).
- Now anywhere in TWinForm2, you should be able to call Form1.Close_All.

-- 
Wayne Niddery - Winwright, Inc (www.winwright.ca)
"Some see private enterprise as a predatory target to be shot, others
as a cow to be milked, but few are those who see it as a sturdy horse
pulling the wagon." - Winston Churchill 
Technical Details
Message-ID: <4506f388$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <op.tfeh4mb0i0jcwv@acer> <44fd87b9$1@newsgroups.borland.com> <op.tfh5rltti0jcwv@acer> <45004696@newsgroups.borland.com> <op.tfipxmrti0jcwv@acer> <450186da$1@newsgroups.borland.com> <45052555$1@newsgroups.borland.com> <45057e04$1@newsgroups.borland.com> <4506c75e@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 1eff29,bdf5a6ead14cc213
X-Google-Attributes: gid1eff29,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Wayne Niddery [TeamB]" <wniddery@chaffaci.on.ca>
From: "Wayne Niddery [TeamB]" <wniddery@chaffaci.on.ca>
Newsgroups: borland.public.delphi.winforms.controls.using
References: <op.tfeh4mb0i0jcwv@acer> <44fd87b9$1@newsgroups.borland.com> <op.tfh5rltti0jcwv@acer> <45004696@newsgroups.borland.com> <op.tfipxmrti0jcwv@acer> <450186da$1@newsgroups.borland.com> <45052555$1@newsgroups.borland.com> <45057e04$1@newsgroups.borland.com> <4506c75e@newsgroups.borland.com>
Subject: Re: one form influencing another
Date: Tue, 12 Sep 2006 13:51:07 -0400
Lines: 29
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 69.17.150.141
Message-ID: <4506f388$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1158083464 69.17.150.141 (12 Sep 2006 10:51:04 -0700)
X-Authenticated-User: wniddery
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail