LCL: Implement TApplication.HelpShowTableOfContents. Issue #25905.

git-svn-id: trunk@65478 -
This commit is contained in:
juha 2021-07-20 19:44:31 +00:00
parent 00037248cf
commit 27af6874b9
3 changed files with 20 additions and 2 deletions

View File

@ -1513,6 +1513,7 @@ type
function HelpCommand(Command: Word; Data: PtrInt): Boolean;
function HelpContext(Context: THelpContext): Boolean;
function HelpKeyword(const Keyword: String): Boolean;
function HelpShowTableOfContents: Boolean;
procedure ShowHelpForObject(Sender: TObject);
procedure RemoveStayOnTop(const ASystemTopAlso: Boolean = False);
procedure RestoreStayOnTop(const ASystemTopAlso: Boolean = False);

View File

@ -198,7 +198,7 @@ type
THelpManager = class(TObject)
public
function DoHelpNotFound(var ErrMsg: string): TShowHelpResult;
class function DoHelpNotFound(var ErrMsg: string): TShowHelpResult;
function ShowTableOfContents(var ErrMsg: string): TShowHelpResult; virtual;
procedure ShowError(ShowResult: TShowHelpResult; const ErrMsg: string); virtual; abstract;
// show help for ...
@ -545,7 +545,7 @@ end;
{ THelpManager }
function THelpManager.DoHelpNotFound(var ErrMsg: string): TShowHelpResult;
class function THelpManager.DoHelpNotFound(var ErrMsg: string): TShowHelpResult;
begin
Result:=shrHelpNotFound;
ErrMsg:='Help not found';

View File

@ -1293,6 +1293,23 @@ begin
Result := False;
end;
function TApplication.HelpShowTableOfContents: Boolean;
// A Delphi compatible method.
var
ErrMsg: string;
HelpRes: TShowHelpResult;
begin
if Assigned(HelpManager) then begin
// ShowTableOfContents must be implemented to actually get help. By default it
HelpRes := HelpManager.ShowTableOfContents(ErrMsg); // returns shrHelpNotFound.
Result := HelpRes = shrSuccess;
end
else begin
//HelpRes := THelpManager.DoHelpNotFound(ErrMsg); // Class function.
Result := False;
end;
end;
procedure TApplication.ShowHelpForObject(Sender: TObject);
begin
if Sender is TControl then