Search code examples
delphidelphi-xe2delphi-7

Are Delphi's DFM compatible among different versions?


I am migrating from D7 to XE2, and some of the DFM files have been changed by the IDE.

In some files, the changes are just a couple of simple properties like deleting ItemHeight or adding ExplicitLeft = 0.

However, in other files the change is bigger like removing an entire object declaration, I can check this when I compare dfm files with D7.

When I add the missing part of the DFM from D7 in XE2, it saves without the error:

Class TGenReglas not found. Ignore the error and continue?

I already checked and TGenReglas is in the project, I even add its folder to the project path, just in case.

After saving, and reopening the project, none of my changes are saved.

Could I just copy the DFM files from D7 into XE2 in order to solve this or what should i do?


Solution

  • The basic DFM format is compatible between Delphi versions. It's a serialized tree of objects with a set of properties for each object.

    The properties that get saved can change from one version to another, though. Generally it's safe to load a DFM from an earlier version into a newer version, but not necessarily the other way around. The Explicit* properties are an example of something new that was added after Delphi 7.

    If the form designer is throwing the "Class not found" error, that means that the form was saved with a component that hasn't been registered with the IDE, so the IDE is unable to load it. You need to find the package that that component was in and Install it in the IDE.