Search code examples
delphidfm

Prevent Delphi 10.2 from auto adding properties to TForm


I have a codebase that I'm working on that is written to work in both Delphi 5 and Delphi 10.2, until we get everything converted to D10.

Whenever I open a DFM file in 10.2 and save it, it automatically adds a DesignSize property to the TForm. This property doesn't exist in D5, so I get errors every time I open the same DFM in D5.

Is there any way to prevent D10 from auto-updating the DFM? Or is this not possible?


Solution

  • You could clear them out using a utility when needed. The JVCL includes a utility called DFM Cleaner that does this. In ends up in $(JVCL)\DevTools after JVCL is installed.

    DFMCleaner is a tool to remove unsupported properties from DFMs. If you save a dfm file in one version of Delphi and want to use it in an earlier version, chances are there are some unsupported properties in it, generating an error when the form is opened in Delphi. What's even worse, if the dfm is part of a design-time package, Delphi will install the package without errors but when you try to access the form at design-time (f ex if the form is used by a property editor), Delphi generates an AV instead.