How can I verify that the link "Properties" to the components is not "lost"?

I use Delphi 2007. Sometimes the properties associated with components are lost. Usually these are Action and lookupdatasets properties. I had several bugs fixed and a version for clients came out with a somewhat disastrous result because of this :-) Does anyone know how to check if the properties that should be set are really set, or a way to prevent this?

+6
delphi
source share
6 answers

You got some good answers on how to determine when this happens (voted). But one way to prevent it (sometimes) is to make sure that you add all the reference units to your DPR. If you open a form, for example, which contains components that reference other components in the data module, and that the data module has not been added to the DPR / project, you are almost guaranteed that the IDE will delete these links, as this will delete links that it does not can determine valid. If, on the other hand, the data module is in DPR, then the IDE will be able to find it, and it is unlikely to delete links in the first place

Unfortunately, this still happens from time to time, so you still need to take the precautions described in detail in the other answers. But it will improve the situation if you do not already.

+5
source share

You can assign such values ​​in the code, obviously.

However, more importantly, you must delimit each file before moving on to sourcecontrol. Always.

Make sure your dfm files are text and not binary. Then it will be easy to see unwanted changes before registering / committing.

The difference in everything stopped a lot of potential mistakes for me.

The automatic assembly and test system will also give you some confidence in what you deliver.

+10
source share

Create a dunit testing project. Run the test before release. The sound of all bells when the test fails.

+2
source share

You need a way to verify that the values ​​are set correctly. You can use unit tests for this. Just run the form, compare the properties and do it.

Comparing dfm is also a good way, but it does not account for changes due to changes in default values ​​or changes in code.

+1
source share

When you add a form, data module, or frame to a project, the IDE inserts a small comment tag after the element name in the dpr file. In my experience, if for some reason this tag is missing, the IDE is more likely to lose links to components.

I sincerely support the idea of ​​always considering the differences before each commit of version control, if you use such a thing.

+1
source share

I don't like to say this, but Source Code Control can help in these situations. Even when fixing the crash, you should check everything in the source code repository ( Perforce is my personal favorite). In a small fix, you can see which files have changed, if you have any changes that you do not expect.

+1
source share

All Articles