Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to add comment in delphi form

Tags:

delphi

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.

like image 841
Nalu Avatar asked Aug 21 '12 21:08

Nalu


People also ask

How to add comment in Delphi?

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.

How to put comments in dfm file?

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.

How do I comment multiple lines in Delphi?

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.


2 Answers

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.

like image 170
Uwe Raabe Avatar answered Nov 09 '22 22:11

Uwe Raabe


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.

like image 22
James L. Avatar answered Nov 09 '22 22:11

James L.