Problem
I am using Embarcadero C++ Builder XE. I am trying to trigger the opening of a help file (*.chm), when the user presses the F1 button on their keyboard. I thought I had done everything correctly, but I get no response/action when F1 is pressed.
What I did:
I have created a .chm help file (using Microsoft HTML Help Workshop). I have copied the compiled .chm file to the application directory. I have set:
Application->HelpFile = "My_Help.chm";
In the main form, I have set the HelpFile property to the same .chm file.
In the main form I have included the following two lines of code:
#include "HtmlHelpViewer.hpp"
#pragma link "HTMLHelpViewer"
The confusing thing is: I had this working a few weeks ago, and subsequently 'lost' the code :(
And since then, when I went to recreate the solution, I have had no success.
Also
If I define a help button, as detailed here ( embarcadero ), still nothing happens.
However, if I attach the following code to a button, the help file DOES open:
Application->HelpContext(0);
Question
Has anybody any idea why this would have worked before, but now it doesn't? Perhaps there is a simple step I did in the past and have forgotten, but I have searched all the help on this that I can find (including here at helpscribble), and covered all the steps as I see it. Any help would be much appreciated.
(I tried posting on the Embarcadero forums but that is a complete waste of time at the moment)
I have experience in help authoring but I'm not a C++ programmer. Nevertheless, the C++ Builder Community Edition is installed on my Windows10 PC.
My SDIForm has following code snippet:
I copied the CHM file (CHM-example.chm) into the build directories for simplification (Base, Debug and Release). It is working for me.
My resulting HTMLHelp Viewer window:
After deleting the CHM file (CHM-example.chm) in the three directories mentioned above I tried following steps from the docs - this is working too. But please note I had to delete following code (see screenshot):
The usual way to designate the main help file for an application is using the HelpFile property of the global Application object.
Open the Project Options dialog box (Project > Options) and select the Appearance page (under Application). In the Help file option, specify the help file. Click Browse. By default, the Application Help File dialog box shows only files with the .hlp extension. To specify other types of help files, select the Any file (.) type in the Files of type control. Then you will be able to select help files of types such as .CHM, .HTML, and others.
This option sets the Application.HelpFile property. This property defines the main help file to the application. When the application receives any help-handling command, it, by default, uses this help file to execute the help command.
To specify an individual help file for a particular form, you can use the HelpFile property of this form.