Disabling the form designer in DelphiXE
Is it possible to disable the form designer in DelphiXE "on-demand/selec开发者_如何学Pythontively" and only work with the code of a form/class where needed, in the event that controls are not installed in the IDE?
I'd say the answer is no, but the workaround that I use is to edit the DFM file and cut out the component that is not there, and paste it to the FormCreate event and instantiate it there instead. The properties are all there in the DFM, so a little editing makes it work nicely.
No you can't disable it selectively. What I often do (as I have hardly any controls installed in most of my IDE's) is that I just open the form, tell Delphi to ignore all errors when loading the dfm, do my editing of the source code and make sure I don't check in the dfm to my source control system.
You could try to keep the dfm readonly to avoid mistakenly checking in a dfm with deleted controls, but there is a drawback to that: every time you try to save your source the IDE will come up with an error about the readonly-ness of the file. If you hit Ctrl-S or Shft-Ctrl-S as often as I do, that quickly becomes a nuisance.
When I do have to change the dfm, I do it in text mode, or install the controls, do the dfm changes and submit. After that I am free again to de-install the controls and just work on the pas file, ignoring / reverting any changes to the dfm.
No, and there is no reasonable workaround for it at this time.
I have asked for this to be a feature in Delphi at some point in the future; That DFMs should not be destroyed by opening them, nor should multiple modal dialog boxes asking if you want to destroy your DFMs be the default behaviour when opening a form that does not have the controls installed.
In the end there is only one practical solution; Install all the controls. Anything else is just going to drive you crazy.
精彩评论