I hesitated posting this message, lest I be seen bashing Borland
again. But really, some of you need to know this (if you havent been
hit by it by now).
At first glance this should work fine, just the perfect hook for
initalising fields in a new record......
type
TTableCmn = class(TTable)
procedure DoOnNewRecord; override;
end;
TTable1 = class(TTableCmn)
procedure DoOnNewRecord; override;
end;
implementation
procedure TTableCmn.DoOnNewRecord;
begin
inherited; /// the normal thing to do
FieldByName ('CommonField').AsInteger := 1;
end;
procedure TTable1.DoOnNewRecord;
begin
inherited; /// let the parent initialise common stuff
FieldByName ('MyField').AsText := 'blah';
end;
But, the dratted DoOnNewRecord in TTable/TDataSet calls the forms
OnNewRecord event. If this is assigned, it gets executed first, but
surely, normally I want this executed last.
And no, you cant call inherited last in the overridden methods. You
have to redo all the code on ever overridden method. That is, the
prime concept of building up behaviour neatly falls down.
It would appear that this applies to all the Onxxxxx events in the
VCL. So beware when writing families of components.
Regards
Rohit
======================================================================
CFL - Computer Fanatics Ltd. 21 Barry's Point Road, AKL, New Zealand
PH (649) 489-2280
FX (649) 489-2290
email [EMAIL PROTECTED] or [EMAIL PROTECTED]
======================================================================
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz