RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TApplication.HelpFile Property

Specifies the name of the default file the application uses to display Help.

Pascal
property HelpFile: string;
C++
__property AnsiString HelpFile;

Use HelpFile to specify a default help file for applications that use the Help system. Either assign a file name to the HelpFile property at runtime, or specify a Help File on the Application page of the Project|Options dialog box at design time. 

The Help system specified by HelpSystem displays help topics from the file specified by CurrentHelpFile. HelpFile supplies the value of CurrentHelpFile unless there is a help file associated with the active form. 

By default, HelpFile is a null string, and the application's Help method ignores attempts to display Help unless the active form has an associated help file.  

C++ Examples: 

 

/*
The following code changes the Help file depending on the
active form, before the help viewer is called. AppHelp is
assigned to the OnHelp event handler of Application in the
OnCreate event of Form1.
*/
bool __fastcall TForm1::AppHelp(Word Command, int Data, bool &CallHelp)
{
  Application->HelpFile = Screen->ActiveForm->Name + ".hlp";
  CallHelp = true;
  return true;
}

void __fastcall TForm1::FormCreate(TObject *Sender)
{
  Application->OnHelp = AppHelp;
}

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  const DATANOTFOUND = 714;
  Application->HelpContext(DATANOTFOUND);
}

 

Delphi Examples: 

{
The following code changes the Help file depending on the
active form, before the help viewer is called. AppHelp is
assigned to the OnHelp event handler of Application in the
OnCreate event of Form1.
}
function TForm1.AppHelp(
  Command: Word; Data: Longint; var CallHelp: Boolean) : Boolean;
var helpstring : String;
begin
  helpstring := Screen.ActiveForm.Name + '.hlp';
  MessageDlg(
    'Using ' + helpstring + ' as the help file.',
    mtInformation, [mbOK], 0);
  Application.HelpFile := helpstring;
  CallHelp := True;
end;

procedure TForm1.Button1Click(Sender: TObject);
const DATANOTFOUND = 714;
begin
  Application.HelpContext(DATANOTFOUND);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Application.OnHelp := AppHelp;
end;

 

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