Delphi: how to lock dfm-s to not change…?

半世苍凉 提交于 2019-12-24 12:16:59

问题


We used Delphi 6 long times ago. Our problem, that Delphi have two problems with DFMs:

1.) When some linked resource (like DataSet) will removed, Delphi many times forget to ask you that "some of the resources are linked, you need to redirect...". This happens, when the actual form is not added to the project, or it is not opened.

2.) When we only open the DFM, and only see some thing, may we change it (active TabSheet, form position). Then Delphi auto save the form - and sometimes it drops the links. Another problem with this that we used SVN, and SVN detect these changes...

We thought that we change DFM files to read only, but this can prevent the usage of SVN too...

So somebody please help us: have the Delphi some extension (like gexpert) that can lock the DFMs to avoid changes, and some other tool to see that dataset is used in other forms or not?


回答1:


You're kinda cheating on Delphi. It is built to manage the duality *.pas and *.dfm altogether, knowing how to maintain the links (and with form inheritance, it's better to have all the stack open).

If you want to manually interfere, you have to know what you are doing and do it very carefully. You're not supposed to fiddle with the dfm insides more than to edit the form code portion before the private section.

What I do when I have to edit the dfm manually is to make sure it's not open in any way in delphi (beware form inheritance) and then edit it in another editor. Also when I check the pas/dfm back in, I do a diff on the dfm to make sure nothing bad happened to it.



来源:https://stackoverflow.com/questions/2912180/delphi-how-to-lock-dfm-s-to-not-change

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!