I want to add some comments the automatically generated form (dfm) files. In pas we can comment using // or {} but how to add comment in dfm?
Is it possible to add comment? I tried add comment at end of dfm but when i reopen comment gets deleted.
thanks or help.
The Delphi team requires the use of curly brace comments, rather than parentheses star comments. The words in your comments should start on the same line as the first curly brace and the closing brace should be on the line of the final text. In other words, don't put curly braces on a separate line.
Earlier versions of Delphi used the internal binary format for DFM files, which can still be achieved by changing a setting. There is no place for comments in that, too. Update: You can still write your documentation right above the declaration of the control in the PAS file.
Use the parenthesis-star (*... *) both for development comments and for commenting out a block of code that contains other comments. This comment character permits multiple lines of source, including other types of comments, to be removed from consideration by the compiler.
No, that is not possible. A DFM file is nothing but a representation of the object structure. Normally you shouldn't read nor write any DFM file directly (unless you know exactly what you do). Earlier versions of Delphi used the internal binary format for DFM files, which can still be achieved by changing a setting. There is no place for comments in that, too.
Update: You can still write your documentation right above the declaration of the control in the PAS file.
Published component properties are written to the DFM file, and the IDE manages that entire process. Any unsupported content in the DFM will be discarded the next time the IDE opens the form, which you have already observed.
Workaround: If you just want to add comments to a small number of components, you could easily write a component wrapper and add one new published property where you could add a comment through the property editor. Kind of a hokey workaround, but doable... The drawback is that your comments would be compiled into the EXE.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With