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);
Actually, I always think the most *fun* ( for varying values of fun )
way of doing this is with a callback function. (If you squint just so, you can pretend delphi handles closures...)
Admittedly I haven't ever tried doing it with interfaces.
Cheers, Kurt.
Unit MainForm; type
TCorrRecordWriteProc = function( TObject, integer, integer, string): Object of object;
TMainForm = class(TForm) UV: TUVObjects; {private} WriteNewCorrRec : TCorrRecordWriteProc; ...
implementation procedure TMainForm.OnCreate; ... WriteNewCorrRec := DatabaseUtils.WriteNewCorrRecord; ...
procedure TMainForm.UpdateWMS(PolNum: string); ... //check WriteNewCorrRe is assigned etc...
NewCorrKey := WriteNewCorrRec(Sender,CORR,CORI,PolNum);
---------------------------------------------------------------------------
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/