Stop C++Builder XE from removing/editing UI components in the .dfm files
How can I stop C++Builder XE from automatically editing .dfm files?
I'm currently porting a rather big code base from BCB5 to XE. A lot of external components have been used in the old code, but are not yet installed for the new environment (since I need to find working substitutes or port them myself). Now, the Builder removes/changes the definitions of these UI components in my dfm files. If the IDE does not find the implementation of the compone开发者_Go百科nt, it is removed completely. For known components, the size is changed by a small value quite a lot of times. How can I turn of this annoying behavior?
It will edit both the DFM and the header file to remove components.
There are three options:
When the IDE opens a form for which components don't exist, it will ask you what to do. You can click "Ignore All" and it won't remove those component references.
If you're using source control, you should be able to revert those changes. Ie, let the IDE do whatever it wants, and then revert or don't commit those changes.
The best approach though would be to actually have those components installed. If you're opening forms in the project but the components don't exist, what are you trying to do? You won't be able to compile them. And if you need to replace the components with different ones, what's wrong with the IDE removing the old ones?
You should probably try to install newer versions of the same components where possible first, before upgrading the project and its files yourself. Then upgrade the project and on a case-by-case basis let it remove references to components that don't exist, and replace them with your different components.
"For known components, the size is changed by a small value quite a lot of times."
Technically this is a different question ;) But if it's small, ignore it. Some properties like ExplicitLeft
and ExplicitTop
will almost certainly change, and I think this is due to different window title bar and edge widths (usually seen if you're using, say, Vista when the form was saved with XP. I think. I've never quite figured out why these constantly change, but it doesn't seem to affect anything.) Make sure you are using a system with the same DPI setting as the one the forms were last saved on, too (this is the font size setting in your Display properties.)
I found out that the dfm files are only changed by the IDE if the corresponding cpp or h file is open. This way, I can compile the source, the compiler will throw an error as soon as unknown components/properties are found and I can resolve them.
精彩评论