Recent

Author Topic: Prevent storing of ColWidths of a TCustomDrawGrid descendant  (Read 10156 times)

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Prevent storing of ColWidths of a TCustomDrawGrid descendant
« Reply #15 on: January 12, 2015, 04:30:43 am »
Open old project1 which was created with the original version of TStringGrid  --> Stream-Read Error "No property ColWidths". This means that the new version is not backward compatible - I absolutely want to avoid this.
You can instruct the reader not to complain by calling RegisterPropertyToSkip.

In your example of TStringGrid add to the end of Grids.pas:
Code: [Select]
...
initialization
  RegisterPropertyToSkip(TStringGrid, 'ColWidths', 'Mention the reason you removed this property','');

end.
Recompile Lazarus
Open old project1 which was created with the original version of TStringGrid  --> No problem!

This same method was used in TAChartAxis:
Code: [Select]
procedure SkipObsoleteAxisProperties;
const
  TRANSFORM_NOTE = 'Obsolete, use Transformations instead';
begin
  RegisterPropertyToSkip(TChartAxis, 'Offset', TRANSFORM_NOTE, '');
  RegisterPropertyToSkip(TChartAxis, 'Scale', TRANSFORM_NOTE, '');
  RegisterPropertyToSkip(TChartAxis, 'Transformation', TRANSFORM_NOTE, '');
end;
...
initialization
...
  SkipObsoleteAxisProperties;   

wp

  • Hero Member
  • *****
  • Posts: 13268
Re: Prevent storing of ColWidths of a TCustomDrawGrid descendant
« Reply #16 on: January 12, 2015, 12:43:54 pm »
Thanks, engkin. Works perfectly. I used your solution in fpspreadsheet now since it is not dependent on a modification of grids.pas.

Bart

  • Hero Member
  • *****
  • Posts: 5648
    • Bart en Mariska's Webstek
Re: Prevent storing of ColWidths of a TCustomDrawGrid descendant
« Reply #17 on: January 12, 2015, 01:43:50 pm »
I changed the resolution of the bugreport to: no change required.

Bart

 

TinyPortal © 2005-2018