Creating IDE Help

From Free Pascal wiki
Jump to navigationJump to search

Template:Creating IDE Help

Help for LCL units

Whenever the user presses F1 for an Object Inspector property or on an identifier in the source editor the IDE searches the declaration and invokes the HTML viewer for the fpdoc item. The items can be edited easily via the LazDoc tool.

You can see the state of the LCL documentation here: LCL Documentation Roadmap.

Help for IDE windows

This feature exists since 0.9.15.

The help for the IDE windows (i.e. 'Object Inspector' or the 'Compiler Options') are documented in this wiki. The IDE has a mapping file docs/IDEWindowHelpTree.xml, which contains the paths from the various IDE forms/controls to wiki pages. This mapping file is edited via an editor that is shown at any place in the IDE via Ctrl+Shift+F1, except for controls, that catches all keys, like synedit. You can set the short cut in the editor options -> key mapping.

The root page of the IDE window docs is Lazarus IDE.

Example

  • Open the project options: Project / Project Options
  • Open the help editor: Shift+Ctrl+F1

HelpEditor1.png

  • To the left you can see all controls of the project options dialog. You can see there are also the compiler options.
  • Select the ProjectApplicationOptionsFrame
  • Click Create Help node. This will create a new item on the right.
  • Check Has Help
  • Check Is a root control. All controls on the frame should use the help on our new help page.
  • Change the path to Project_Options

HelpEditorProjectOptions.png

Redirect

The TreeView in the IDE options dialog redirects the help to the help of the selected frame:

ide/ideoptionsdlg.pas

<Delphi> procedure TIDEOptionsDialog.CategoryTreeKeyDown(Sender: TObject; var Key: Word;

 Shift: TShiftState);

var

 Command: Word;

begin

 Command := EditorOpts.KeyMap.TranslateKey(Key,Shift,nil);
 if (Command=ecContextHelp) and (PrevEditor <> nil) then begin
   Key:=VK_UNKNOWN;
   ShowContextHelpForIDE(PrevEditor);
 end;

end; </Delphi>

Help for FPC keywords

This feature exists since 0.9.15 and requires the FPC docs as HTML installed locally.

This is invoked when the cursor in the source editor is above a keyword and the user pressed F1. The IDE searches in the FPC html documentation for the ref.kwd file. This file is maintained by the FPC team and contains a list to all HTML pages. At the moment no custom help is implemented.

TODO: Document, where to get/ how to create FPC Html docs.

Help for Messages

This feature exists since 0.9.15 and requires the FPC sources installed locally.

This is invoked when the user presses F1 or uses the Help menu item of the message window.

Normally the IDE will search the errore.msg file in the FPC sources and show the comment for the message. But some messages like unit not found need extra help. The following describes how to do that:

To add a wiki help page for a message, do the following:

  • Create a wiki page under the root Build messages
  • Open ide/helpfpcmessages.pas and add a AddFPCMessageHelpItem line like:
  AddFPCMessageHelpItem('Can''t find unit',
                        'FPC_message:_Can_not_find_unit',': Can''t find unit ');

The first parameter is the title shown in errors. The second parameter is the wiki URL. And the third parameter is the regular expression to match the message.

Adding Kylix help

How to use the Borland Help files within the IDE editor: Adding Kylix Help