Providing Help for Your Component
Go Up to Making components available at design time
You can create your own CHM help files and add them to RAD Studio. In this topic, you can see how to create help for new library files.
You can create the help so once you press F1, the appropriate file opens according to the class or member you are located when F1 is pressed.
This topic shows you how to create the CHM file and how to install the help files in RAD Studio. You can also see the sample that illustrates a possible structure for the CHM help file.
Contents
Installing the CHM Help Files
When you compile the files, you generate a .chm file. RAD Studio stores the CHM files in the following paths depending on the language:
- English:
C:\Program Files (x86)\Embarcadero\Studio\23.0\Help\Doc
- German:
C:\Program Files (x86)\Embarcadero\Studio\23.0\Help\Doc\de
- French:
C:\Program Files (x86)\Embarcadero\Studio\23.0\Help\Doc\fr
- Japanese:
C:\Program Files (x86)\Embarcadero\Studio\23.0\Help\Doc\ja
You do not need to use the above paths, you can copy your CHM help files to any folder ensuring that the language CHM files are stored in the appropriate language folder as follows:
- English:
MyDirectory
- German:
MyDirectory\de
- French:
MyDirectory\fr
- Japanese:
MyDirectory\ja
You need to create the new value in the Registry Editor.
- Go to the following path:
HKEY_CURRENT_USER\Software\Embarcadero\BDS\23.0\Help\HtmlHelp1Files\
- In the right pane, right-click and select New > String Value, then rename the new value with a descriptive name.
- Double-click this new entry to add the full path and CHM file name to Value data. For example, if you are using the same path as RAD Studio to store the CHM you need to add the following in Value data
%programfiles(x86)%\Embarcadero\Studio\23.0\Help\Doc\NameOfYourCHM.chm
, where NameOfYourCHM.chm is the .chm you have previously compiled and copied to such directory as explained above. Indicate only the path to the English version of the CHM, even if you are not adding help in English language. Ensure to add the correct .chm file name; RAD Studio automatically looks for the CHM in the different help language folders mentioned above, according to the language. If you add help in several languages, ensure that files with the same translated content have the same .chm file name.- Note: Paths using macros are not supported, only environment variables are allowed.
You need to add a new registry value for each .chm file.
CHM Help Sample
This sample illustrates a possible CHM. The sample uses a new component, called TClockLabel
, and a new developed Format
property for this component. The new component has been developed in a new unit called ClockLabel.pas
.
The sample uses the Welcome.htm
page as default first page.
Bear in mind that the name between the <Title></Title>
.html tags, as well as the Keyword field of the Index entry must be fully qualified, as shown in the table below, the rest is open for you to configure as required.
The table below displays a four-level CHM help sample with the required text between the <Title></Title>
.html tags and the text of the Keyword field of the Index entries which both are the fully qualified:
Item | Represents | Between the <Title></Title> .html tags & Keyword field of the Index entry
|
Recommended .htm Name |
---|---|---|---|
Welcome | The default page | Welcome | Welcome.htm |
ClockLabel | The ClockLabel.pas unit | ClockLabel | ClockLabel.htm |
TClockLabel | The TClockLabel class developed inside the ClockLabel unit | ClockLabel.TClockLabel | ClockLabel.TClockLabel.htm |
Format | The Format property of the TClockLabel class | ClockLabel.TClockLabel.Format | ClockLabel.TClockLabel.Format.htm |
The table above only illustrates a possible sample, since you may, for example, add extra levels to group the methods/properties together.
Providing Access to Your CHM Files on the Help Menu of the IDE
You can extend the IDE so that the Help > Third-Party Help menu shows an entry for your product and provides menu items to open your CHM files. Extending the IDE Using the Tools API explains the required steps to extend the IDE, and Adding an Item to the Main Menu of the IDE shows how to extend the main menu.
For example code that shows how to add your help to the Help > Third-Party Help menu, see:
- Third-Party Help Menu Item (Delphi) code example
- Third-Party Help Menu Item (C++) code example