further to what Rob said:

it is not clear from your main form code snippet what 'sender' is so try
something like:

    NewCorrKey := WriteNewCorrRecord(Self.UV,CORR,CORI,PolNum);   // this
calls DatabaseUtils.pas

  Code from DatabaseUtils.pas:

  function WriteNewCorrRecord(UV: TUVObjects; CORR, CORI: integer; PolNum:
string): string;
  begin
    if  UV.ReadRecord(CORI,PolNum) then...

assuming of course, UV is the only thing you need to get to, otherwise pass
'self' (the whole mainform object)

regards,
Steve

-----Original Message-----
From: Robert Martin [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 26 February 2003 10:48 a.m.
To: Multiple recipients of list delphi
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/

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.456 / Virus Database: 256 - Release Date: 18/02/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.456 / Virus Database: 256 - Release Date: 18/02/2003
 
---------------------------------------------------------------------------
    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