Show contents 

Forms > Forms Assembly Classes > Form > Form.OnHelp

Form.OnHelp

Syntax

OnHelp(Sender: Object; Args: IEventArgs);

Parameters

Sender. The parameter that returns the component that has generated the event.

Args. The parameter that enables the user to determine event parameters.

Description

The OnHelp event occurs when the component is pressed if the mode of help displaying is active or on pressing the F1 button for the active component.

Comments

Help display mode is activated by pressing the "?" button if BorderStyle = DialogWithHelp. The EnterContextHelpMode method can emulate pressing this button.

The appropriate methods implemented in the IWinApplicationHelp interface should be used to open the help.

Example

Executing the example requires a form and any components on it. The unique values of the HelpContext property are set for all components. This procedure is set to process the OnHelp event of the form. The application folder must contain the Help.chm file.

Sub FormOnHelp(Sender: Object; Args: IHelpEventArgs);
Var
    Help: IWinApplicationHelp;
Begin
    Help := WinApplication.Help;
    Help.Context(Args.ContextId, "Help.chm");
End Sub FormOnHelp;

The Help.chm help file opens when the component is selected and the F1 key is clicked. The appropriate help section is searched by the value of identifier of the help section set for the particular component.

See also:

Form | IWinApplicationHelp