Sounds good to me :)

Rob

Software engineer
Wild Software Ltd
Ph 03 377-0495
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
Sent: Wednesday, February 26, 2003 11:40 AM
Subject: RE: [DUG]: How do I refer back to a calling form?


> Thanks everyone. I've worked with Robert's comments on avoiding tight
> coupling and Paul's comments below, and changed my approach. I now only
pass
> PolNum and my datamodule gets its own UV object to work with (UV contains
> all the procedures and methods for writing to our Universe database).
>
> So now MainForm only needs:
> NewCorrKey := DM.WriteNewCorrRecord(PolNum);
>
> Thanks again. :-)
>
> Dave
>
> -----Original Message-----
> From: Paul Mckenzie [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, 26 February 2003 11:18
> To: Multiple recipients of list delphi
> Subject: Re: [DUG]: How do I refer back to a calling form?
>
>
> If you are doing this sort of thing - i.e. accessing objects contained in
> the Form
>
> > > Code from DatabaseUtils.pas:
> > >
> > > function WriteNewCorrRecord(Sender: TObject; CORR, CORI: integer;
> PolNum:
> > > string): string;
> > > begin
> > >   if  Sender.UV.ReadRecord(CORI,PolNum) then...
>
> Why not pass the object UV - that way you get away from the need to know
> about the form, you just work with the object given.
> or does the object look at things in the form.
>
> The idea to aim for is - the DatabaseUtils should not know about forms,
the
> Forms can know about the DatabaseUtils - better yet; The Forms do not know
> about DatabaseUtils,
> Forms know about Database Units (e.g. DataModules) and the Database Units
> know about the DatabaseUtils (the DatabaseUtils should still not know
about
> the Database Units).
>
> Regards
> Paul McKenzie
> Analyst Programmer
> SMSS ltd.
>
> ----- Original Message -----
> From: "Robert Martin" <[EMAIL PROTECTED]>
> To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
> Sent: Wednesday, February 26, 2003 10:47 AM
> Subject: Re: [DUG]: How do I refer back to a calling form?
>
>
> > Type sender as TMainForm(Sender).uv  etc
> >
> > Why not pass UV directly ?
> >
> >
> > Rob
> >
> > Software engineer
> > Wild Software Ltd
> > Ph 03 377-0495
> > ----- Original Message -----
> > From: <[EMAIL PROTECTED]>
> > To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
> > Sent: Wednesday, February 26, 2003 10:38 AM
> > Subject: RE: [DUG]: How do I refer back to a calling form?
> >
> >
> > > Hi Paul
> > >
> > > Yes I thought it was that basic, but it doesn't work for me. :-(
> > >
> > > Some code snippets from MainForm.pas:
> > >
> > > type
> > >   TMainForm = class(TForm)
> > >     UV: TUVObjects;
> > > ...
> > > procedure TMainForm.UpdateWMS(PolNum: string);
> > > ...
> > >   NewCorrKey := WriteNewCorrRecord(Sender,CORR,CORI,PolNum);   // this
> > calls
> > > DatabaseUtils.pas
> > >
> > > Code from DatabaseUtils.pas:
> > >
> > > function WriteNewCorrRecord(Sender: TObject; CORR, CORI: integer;
> PolNum:
> > > string): string;
> > > begin
> > >   if  Sender.UV.ReadRecord(CORI,PolNum) then...
> > >
> > > When doing a syntax check, it doesn't recognise UV in this unit. If I
> type
> > > "Sender." and look at the list that comes up, it's not the same as if
I
> > type
> > > "MainForm." when in the originating form.
> > >
> > > I know I'm displaying my complete ignorance, but I want to learn.
Should
> I
> > > pass MainForm in the place of Sender (that didn't seem to work
either).
> > > Please note that the calling form may have some completely different
> name.
> > >
> > > Thanks for any ideas.
> > >
> > > Dave
> > >
> > >
> > > -----Original Message-----
> > > From: Paul Mckenzie [mailto:[EMAIL PROTECTED]
> > > Sent: Wednesday, 26 February 2003 10:24
> > > To: Multiple recipients of list delphi
> > > Subject: Re: [DUG]: How do I refer back to a calling form?
> > >
> > >
> > > pass a "Sender" parameter
> > >
> > > Regards
> > > Paul McKenzie
> > > Analyst Programmer
> > > SMSS ltd.
> > >
> > > ----- Original Message -----
> > > From: <[EMAIL PROTECTED]>
> > > To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
> > > Sent: Wednesday, February 26, 2003 10:07 AM
> > > Subject: [DUG]: How do I refer back to a calling form?
> > >
> > >
> > > > Hi everyone
> > > >
> > > > I have a form (MainForm) which calls a function in a unit I'm
> creating,
> > > > called DatabaseUtils. I want this unit to be able to have access to
> the
> > > > public variables etc. of the calling form, without needing to
hardcode
> > > into
> > > > the DatabaseUtils unit, "uses MainForm". Any form could have called
my
> > new
> > > > unit. So how do I give my unit, access to the calling form?
> > > >
> > > > Thanks for any advice.
> > > >
> > > > Dave Jollie
> > > > Software Developer BOA IT
> > > > 09 368 4259 ext 6231
> > > >
> > > > The information contained in this mail message is confidential and
may
> > > also
> > > > be legally privileged. If you are not the intended recipient, please
> > note
> > > > that any use, dissemination, further distribution, or reproduction
of
> > this
> > > > message in any form what so ever, is strictly prohibited.  If the
mail
> > is
> > > in
> > > > error, please notify me by return E-mail, delete your copy of the
> > message,
> > > > and accept my apologies for any inconvenience caused.
> > > >
> > >
> >
>
> --------------------------------------------------------------------------
> > > -
> > > >     New Zealand Delphi Users group - Delphi List -
> [EMAIL PROTECTED]
> > > >                   Website: http://www.delphi.org.nz
> > > > To UnSub, send email to: [EMAIL PROTECTED]
> > > > with body of "unsubscribe delphi"
> > > > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
> > >
> > >
> >
>
> --------------------------------------------------------------------------
> > -
> > >     New Zealand Delphi Users group - Delphi List -
[EMAIL PROTECTED]
> > >                   Website: http://www.delphi.org.nz
> > > To UnSub, send email to: [EMAIL PROTECTED]
> > > with body of "unsubscribe delphi"
> > > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
> >
>
> --------------------------------------------------------------------------
> > -
> > >     New Zealand Delphi Users group - Delphi List -
[EMAIL PROTECTED]
> > >                   Website: http://www.delphi.org.nz
> > > To UnSub, send email to: [EMAIL PROTECTED]
> > > with body of "unsubscribe delphi"
> > > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
> > >
> >
> >
>
> --------------------------------------------------------------------------
> -
> >     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> >                   Website: http://www.delphi.org.nz
> > To UnSub, send email to: [EMAIL PROTECTED]
> > with body of "unsubscribe delphi"
> > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
>
>
> --------------------------------------------------------------------------
-
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
> --------------------------------------------------------------------------
-
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
>


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to