Delphi 10.4 stores default VirtualTree's default properties in .dfm file

576 views Asked by At

After updating to Delphi 10.4 Sydney, my instances of TVirtualStringTree store their Colors.XYZ properties in the dfm files, although I left these on the default values:

enter image description here

In VirtualTrees.pas, these color values have a default value, which normally means these shall not be written to a dfm file:

  published
    property BorderColor: TColor index cBorderColor read GetColor write SetColor default clBtnFace;
    property DisabledColor: TColor index cDisabledColor read GetColor write SetColor default clBtnShadow;
    property DropMarkColor: TColor index cDropMarkColor read GetColor write SetColor default clHighlight;
    ...

How to get rid of these default colors in the dfm files?

2

There are 2 answers

0
Joachim Marder On BEST ANSWER

This is result of the fact that StyleServices.IsSystemStyle used to return True in the designer former Delphi version, now in 10.4 it returns False.

This will get fixed soon in Virtual TreeView: https://github.com/JAM-Software/Virtual-TreeView/issues/975

0
dwrbudr On

The root cause probably is that the form designer uses:

'Windows' style in Delphi 10.3 Rio, so StyleServices.IsSystemStyle returns True

'Windows10' style in Delphi 10.4 Rio, so StyleServices.IsSystemStyle returns False

So many component packages are affected by that change and update the component colors in the .DFM files. For example in TMS VCL UI Pack there is this code all over the place (LStyle.Name <> 'Windows')