type TDrmBCDField = class(TBCDField) //override whatever methods you need here end;
unit uDrmBCDFieldReg; interface procedure Register; implementation uses uDrmBCDField, DB; procedure Register; begin RegisterFields([TDrmBCDField, TDrmFMTBCDField]); end; end.
After compiling these packages, you can now get the new custom TField type to display when selecting "New Field..." in the Dataset designer. However, this doesn't address places where you don't use persistent fields, and it doesn't address the (IMO) more commonly used "Add Fields..." or "Add All Fields" context menu items. In order to always use your new custom class, you need to add code like this to your run-time package. By doing this, both the Delphi IDE and your code at run-time will pick up the proper field class type. I had to use code like this because Delphi 6 doesn't have assignable const permissions in the DB.pas unit.
var FieldClass: ^TFieldClass = nil; initialization FieldClass := @DefaultFieldClasses[ftBCD]; FieldClass^ := TTIPBCDField; finalization if Assigned(FieldClass) then FieldClass^ := TBCDField; end.
Notes:
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.