I need to change the TStringGrid (change some private fields/methods). So I made a copy of the pas file. I also deleted the DCU file from Delphi, but I have to see if this is a good idea. Then I put the Vcl.Grids.pas file into my DPR file.
However, my program uses the TMS library, which also needs the Vcl.Grids which leads to this problem: How to recompile a specific unit from the VCL?
So I want to rename the modified Vcl.Grids.pas to Vcl_Grids.pas and TStringGrid -> TStringGrid2.
What is wiser?
- To have TMS use my new component (TStringGrid2 in Vcl_Grids.pas)
- Leave TMS use the original component (TStringGrid in Vcl.Grids.dcu)
TStringGrid
or a so called "class hack". The later is like redeclaring theTStringGrid
class in another unit with the same class name and inheriting from the original one:TStringGrid = class(Vcl.GridsTStringGrid)
. Now you should be able to at least access protected fields and methods of the originalTStringGrid
class. – ActinologyTStringGrid
class. Maybe there is a better way to achieve your goals!? – Actinology