RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomApplicationEvents.OnHelp Event

Occurs when the application receives a request for help.

Pascal
property OnHelp: THelpEvent;
C++
__property THelpEvent OnHelp;

Write an OnHelp event handler to perform special processing when the user requests help. The HelpContext and the HelpJump methods automatically trigger the OnHelp event. 

Set CallHelp to true to have the application call WinHelp after the event. Set CallHelp to false to prevent the application from calling WinHelp. All application help methods go through OnHelp. The application calls WinHelp only if OnHelp's CallHelp parameter returns True, true or if no OnHelp event handler is assigned. 

To find the possible values of the Command and Data parameters, search for WinHelp in the Win32 Developer's Reference Help (Win32.HLP) file, which explains the WinHelp API (application programming interface). The possible values for the Data parameter depend upon the value of the Command parameter. 

The return value is true if the event handler succeeds, false if it fails.

Note: Call the CancelDispatch method from an OnHelp event handler to prevent the application from forwarding the event to any other application events objects.
 

C++ Examples: 

 

/*
This example requires a TApplicationEvents and a TListBox
in the form.  Select the TApplicationEvents, double click
on the OnHelp event and add the following code to the
handler.  Trigger this event by pressing the F1 key or
call the HelpContext method.  Set CallHelp to true if the
application should still invoke the help system after the
event.
*/
bool __fastcall TAppEventForm::ApplicationEventsHelp(WORD Command, int Data,
      bool &CallHelp)
{
    lbOther->Items->Add("Event OnHelp");
    return false;
}

 

Delphi Examples: 

{
This example requires a TApplicationEvents and a TListBox
in the form.  Select the TApplicationEvents, double click
on the OnHelp event and add the following code to the
handler.  Trigger this event by pressing the F1 key or
call the HelpContext method.  Set CallHelp to true if the
application should still invoke the help system after the
event.
}
function TMainForm.ApplicationEventsHelp(Command: Word; Data: Integer;
  var CallHelp: Boolean): Boolean;
begin
  lbOther.Items.Add('Event OnHelp');
  CallHelp := False;
end;

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!