Topic: Using .chm help file in your project

Example, how to work with .chm help file in your project (ver. 3.3 and above):


const
  IDH_TOPIC10 = 10;
  IDH_TOPIC20 = 20;
  IDH_TOPIC30 = 30;
  IDH_TOPIC40 = 40;
  IDH_TOPIC50 = 50;

procedure Form1_OnShow (Sender: string; Action: string);
begin
  Application.HelpFile := ExtractFilePath(Application.ExeName) + 'Help\HelpFile.chm';
end;                



procedure Form1_bContents_OnClick (Sender: string; var Cancel: boolean);
begin
    Application.HelpContents;
end;

procedure Form1_bIndex_OnClick (Sender: string; var Cancel: boolean);
begin
    Application.HelpIndex('test');
end;

procedure Form1_bSearch_OnClick (Sender: string; var Cancel: boolean);
begin
    Application.HelpSearch;
end;

procedure Form1_bTopic30_OnClick (Sender: string; var Cancel: boolean);
begin
    Application.HelpContext(IDH_TOPIC30);
end;                     

procedure Form1_bTopic40_OnClick (Sender: string; var Cancel: boolean);
begin
    Application.HelpContext(IDH_TOPIC40);
end;

procedure Form1_bKeyword_OnClick (Sender: string; var Cancel: boolean);
begin
    Application.HelpKeyword('Test');
end;


Example project:

Post's attachments

Attachment icon Help file chm.zip 8.78 kb, 843 downloads since 2017-03-20 

Dmitry.

2 (edited by mathmathou 2017-03-20 23:46:05)

Re: Using .chm help file in your project

Hello all and many thanks to Dmitry for this huge step forward with MVD !!


In addition to what Dmitry wrote, here is how I use it.


Adding Help buttons for every Form or every already existing button will produce a loooooooot of buttons.


So, I linked the Help system with the middle mouse button :
- when the user left-clicks the button, the application works normally
- when the user middle-cliks the button, the help file opens at the correct page, like this :

procedure Form1_Button1_OnMouseDown (Sender: string; MouseLeft, MouseRight, MouseMiddle: boolean; Shift, Alt, Ctrl: boolean; X, Y: Integer);
begin
    if MouseMiddle = True then Application.HelpContext(IDH_TOPIC_KW_GENERAL);
end;

Hope this helps


Cheers


Mathias

I'm a very good housekeeper !
Each time I get a divorce, I keep the house

Zaza Gabor