Show: Delphi C++
Associating Help with Menu Commands
From RAD Studio
Go Up to Enabling Help in Applications
RAD Studio provides four standard help-handling actions (commands), which can be assigned to your menu items or toolbar buttons.
To assign standard help-handling actions to your menu items
- Open your form in the Form Designer.
- From the Additional category of the Tool Palette, drop the Action Manager component (Vcl.ActnMan.TActionManager) onto the form.
- Create a menu on the form:
- In the form, double-click the Action Manager component; the Action Manager editor opens.
- Click the drop-down arrow next to the New Action button (the leftmost button at the upper-right corner of the Actions tab) and select New Standard Action (or press CTRL+INS); the Standard Action Classes dialog box opens. In the tree of available action classes, browse for the Help category. It contains the Vcl.StdActns.THelpContents, Vcl.StdActns.THelpOnHelp, Vcl.StdActns.THelpTopicSearch, and Vcl.StdActns.THelpContextAction help-handling action classes. Select the desired classes and click OK.
- In the Categories pane in the Action Manager editor, select Help. The Actions pane shows the selected action classes.
- Assign the desired action classes:
- Assign action classes to the action band. In the Actions pane, drag the desired action class onto the action band in the form.
- Assign action classes to menu items. Double-click the menu to open the Menu Designer. Select the required Help menu item; the Object Inspector shows its properties. Open the Events pane and select the Action property. In the right Values column, click the drop-down arrow. The list that appears contains the list of actions already added in the Action Manager editor. Select one of these actions to assign it to the menu item.
- If a required standard action is not shown in the list, select the New Standard Action command. This opens the list of all available Standard Action classes. Expand the desired category and select the desired Standard Action class.
- Set the HelpFile property of the global Application object (the TApplication.HelpFile property) or of a particular form (the TForm.HelpFile property).
- In Delphi applications, add the Vcl.HtmlHelpViewer unit to the uses clause of the main module of your application.
In C++ applications, add the
This specifies that your application uses the API of the HTMLHelp function that shows CHM help files.
- Select the Run > Run command. Your application opens. In the Form1 form, select one of the Help items on the Help menu (or on the action band) to which you have associated a standard help-handling action. The help command corresponding to this action executes.
- Calling HTML Help from Applications
- Help System Interfaces
- Using Help in a VCL Application