Skip to content

How to integrate the Help

Ariel Montes edited this page Oct 24, 2023 · 3 revisions

How to activate this Help into MarkDownHelpViewerDemo Application

Use MarkDownHelpViewer.pas (located into AppInterface folder) in dpr:

  MarkDownHelpViewer in '..\..\AppInterface\MarkDownHelpViewer.pas',

then specify the default file of the help:

  Application.HelpFile := ExtractFilePath(Application.ExeName)+'..\Help\Home.md';

If you have installed the viewer using the provided Setup, the installation folder of the Viewer is registered into:

HKEY_CLASSES_ROOT\Applications\MDHelpViewer.exe\Shell\Open\Command so the interface can launch the viewer automatically.

If you don't want to use the provided Setup you can register the location of the Viewer built by yourself and deployed to a specific location, for example:

{$IFDEF WIN32}
  RegisterMDViewerLocation(ExtractFilePath(Application.ExeName)+
    '..\..\Bin32\MDHelpViewer.exe');
{$ELSE}
  RegisterMDViewerLocation(ExtractFilePath(Application.ExeName)+
    '..\..\Bin64\MDHelpViewer.exe');
{$ENDIF}

Rules to open the correct file using HelpContext or HelpTopic

To test the application you can launch the Home.md help using the menu About/Help: in the OnClick handler invoke the help:

procedure TfmMain.HelpMenuItemClick(Sender: TObject);
begin
  Application.HelpKeyword('home');
end;

In any Delphi component, you can define HelpType (htKeyword or htContext) and the specify HelpKeyword (string) or HelpContext (Integer).

When the user press "F1" inside the application, the HelpSystem is invoked with HelpKeyword or HelpContext.

Then the interface searches in the same folder of default file (specified into Application.HelpFile) the specific file using those rules:

Rules of precedence

  • first search a file named as the Keyword or the Context with any markdown extension (eg. 1000.md, MainForm.md)
  • Then, try the Help Name and the Keyword (eg.Home1000.md, HomeMainForm.md)
  • At least, try the Help Name and the Keyword with underscore (eg.Home_1000.md, Home_MainForm.md)