12

Our Delphi 7 development team stores form files (dfm) in text mode, and uses a source control system (Subversion) to track changes.

Sometimes, we noticed that a form file returned to binary format between revisions, causing diff tools like TortoiseMerge to complain.

Using the Subversion change log, I can see that the DFM file was stored in text form before. The software developers never change the storage file format back to binary manually.

Have you encountered the same? Is it a known problem?

mjn
  • 36,362
  • 28
  • 176
  • 378
  • 5
    This is an old question, and this doesn't answer the question. However google showed me here so if this happens to somebody else I'd like to leave this here. Delphi has a conversion tool, and you run it like this to convert all dfm-files from binary to text: `\bin\convert.exe -i -s -t *.dfm`. Those that are already text are left untouched. – johnny May 28 '19 at 09:40
  • That was indeed very helpful! I've never thought there are a solution for that lol! that's that worked like a charm – Hamza Benzaoui Sep 17 '22 at 08:25

7 Answers7

12

This does happen in Delphi 7 but is fixed in later versions. Usually you access forms in the IDE by opening the .pas file and then switching to the Form View. Right click your form and it will show that it is "Text DFM" ticked if you have done this before.

You will experience the problem you have described of a text DFM switching to a binary DFM when in the Delphi 7 IDE you open the .dfm file directly. eg. File->Open->Somefile.dfm .. Right click the dfm and choose "View as Form". Now right click the form, you will see that the "Text DFM" is unticked.

We were getting the problem when we opened up a DFM which was a grep search result. It had us perplexed also, and would cause corruption of the dfm in cvs as it was checked in as text.

Jared Davison
  • 333
  • 3
  • 11
4

I have seen it happen in Delphi 7 when a form inheriting from another form from a different project was opened in Delphi on its own without the project it belongs to being open.

Lars Truijens
  • 42,837
  • 6
  • 126
  • 143
4

This sometimes happens when the IDE gets confused.

It usually starts after you got an access violation inside the Delphi 7 IDE.

Sometimes also one or mor of your Delphi editor buffers inside the IDE become readonly (while the files on disk are still read/write).

The behaviour occurs much less than in Delphi 5 or 6, but sometimes it does occur in Delphi 7.

The best thing you can do is restart the Delphi 7 IDE as soon as you get an access violation.

Jeroen Wiert Pluimers
  • 23,965
  • 9
  • 74
  • 154
2

If someone has opened the project with different version of Delphi (or changed the default settings), he may save the forms in different format.

Francis
  • 11,388
  • 2
  • 33
  • 37
  • Good hint, I will check this. We have also Delphi 2007 and 2009 installed. The default settings are only for new forms, so I am not sure how they can affect existing forms. – mjn May 09 '09 at 08:31
2

You may be interested in investigating the use of Beyond Compare instead of TortoiseSVN's built-in merge tool. Beyond Compare is written in Delphi, and natively knows how to read binary DFMs. This means that it then becomes less of an issue (or even no issue) whether your DFMs are stored in Subversion in binary or text. Beyond Compare V3 also does 3-way merging which makes it really easy to merge multiple commits etc. Even ignoring the ability to diff binary DFMs, it's still a much better diff viewer than TortoiseSVN's built-in tools. I can highly recommend it, and it's very inexpensive (I have no connection with Scooter Software, other than being a very happy customer).

Scooter Software

Conor Boyd
  • 1,024
  • 7
  • 15
1

We've certainly encountered this. We use D7 exclusively.

Never got to the bottom of it as it happens only half a dozen times a year or so, and although it's a nuisance it's fairly easily remedied.

I was interested to see Lars's answer, and will certainly look to see if that's a possible cause next time it happens.

RichardS
  • 536
  • 2
  • 8
1

We also have this issue from time to time, and it seems to be related to looking at the DFM's source (Alt-F12) and then doing a Visual Source Safe operation (e.g. check-in).

marius
  • 151
  • 3