Delphi Programming
Advertisement

Help Insight is a feature of the Delphi IDE that displays a popup with a short description of the identifier currently under the mouse cursor. By default it shows the following information:

  • Identifier name
  • Kind of identifier (field/variable/method etc.)
  • source position where it is defined (unit name, line and column)
  • type (e.g. system.string or system.integer

It looks like this:

Simple help insight hint

For methods you also get a description of the parameters and the return value:

Help insight for method

In addition to these basic information it can also evaluate specially formatted comments. These comments must be in the source code just before the declaration (in the interface section of a unit), start with /// (three forward slashes) and contain some XML tags.

According to Marco Cantu's Delphi 2007 Handbook {! and (*! for multiline comments should also work, but for me they don't. I guess there is a difference between generating XML documentation (which works with these multiline comments) and Help Insight (which doesn't). --Dummzeuch 12:17, 16 December 2007 (UTC)

In addition, the Generate XML Documentation option on the Compiler Options must be checked on in order for your custom tags to be displayed in the Help Insight. (In my experience this is not necesary. Just adding triple slash comments is enough.--Dummzeuch 12:17, 16 December 2007 (UTC))


The following tags are being evaluated:

  • summary
  • param (with parameter name="name")
  • returns
  • permission
  • remarks
  • comments

(This list is taken from the HelpInsight.xsl file in the ObjRepos subdirectory of a Delphi 2007 installation.)

Example:

/// <summary>parses the commandline</summary>
///   <param name="CmdLine"> is a string giving the commandline.
///                          NOTE: Do not pass System.CmdLine since it contains the
///                          program's name as the first "parameter".
///                          If you want to parse the commandline as passed by
///                          windows, call the overloaded Parse method without
///                          parameters. It handles this.</param>
procedure Parse(const _CmdLine: string);

which will result in the following code insight hint:

Help insight hint with description

Pawel Glowacki has posted a simple Live Template for adding these kind of documentation comments: http://blogs.codegear.com/pawelglowacki/2007/01/30/31591

Advertisement