added TCustomForm.IntfHelp - a method to be called by the interfaces

git-svn-id: trunk@9274 -
This commit is contained in:
mattias 2006-05-13 12:58:32 +00:00
parent 444e56f095
commit fa83cfbcf9
4 changed files with 55 additions and 32 deletions

View File

@ -685,8 +685,8 @@ type
end;
var
HelpDatabases: THelpDatabases; // initialized by the IDE
HelpViewers: THelpViewers; // initialized by the IDE
HelpDatabases: THelpDatabases = nil; // initialized by the IDE
HelpViewers: THelpViewers = nil; // initialized by the IDE
//==============================================================================
{ Showing help (how it works):
@ -2677,8 +2677,5 @@ begin
BaseURL:=TheBaseURL;
end;
initialization
HelpDatabases:=nil;
end.

View File

@ -498,6 +498,7 @@ type
procedure AddHandlerCreate(OnCreateHandler: TNotifyEvent; AsLast: Boolean=true);
procedure RemoveHandlerCreate(OnCreateHandler: TNotifyEvent);
function IsShortcut(var Message: TLMKey): boolean;
procedure IntfHelp(AComponent: TComponent);
public
// drag and dock
procedure Dock(NewDockSite: TWinControl; ARect: TRect); override;
@ -977,9 +978,11 @@ type
function UpdateAction(TheAction: TBasicAction): Boolean; override;
procedure HandleException(Sender: TObject); override;
procedure HandleMessage;
function HelpCommand(Command: Word; Data: Longint): Boolean;
function HelpContext(Sender: TObject; const Position: TPoint;
Context: THelpContext): Boolean;
function HelpContext(Context: THelpContext): Boolean;
function HelpJump(const JumpID: string): Boolean;
function HelpKeyword(Sender: TObject; const Position: TPoint;
const Keyword: String): Boolean;
function HelpKeyword(const Keyword: String): Boolean;
procedure HideAllFormsWithStayOnTop;
function IsWaiting: boolean;

View File

@ -920,18 +920,8 @@ begin
if not Terminated then Idle(true);
end;
{------------------------------------------------------------------------------
function TApplication.HelpCommand(Command: Word; Data: Longint): Boolean;
------------------------------------------------------------------------------}
function TApplication.HelpCommand(Command: Word; Data: Longint): Boolean;
begin
Result := InvokeHelp(Command, Data);
end;
{------------------------------------------------------------------------------
function TApplication.HelpContext(Context: THelpContext): Boolean;
------------------------------------------------------------------------------}
function TApplication.HelpContext(Context: THelpContext): Boolean;
function TApplication.HelpContext(Sender: TObject; const Position: TPoint;
Context: THelpContext): Boolean;
begin
if ValidateHelpSystem then begin
Result := true;
@ -941,13 +931,19 @@ begin
end;
{------------------------------------------------------------------------------
function TApplication.HelpJump(const JumpID: string): Boolean;
function TApplication.HelpContext(Context: THelpContext): Boolean;
------------------------------------------------------------------------------}
function TApplication.HelpJump(const JumpID: string): Boolean;
function TApplication.HelpContext(Context: THelpContext): Boolean;
begin
Result:=HelpContext(nil,Point(0,0),Context);
end;
function TApplication.HelpKeyword(Sender: TObject; const Position: TPoint;
const Keyword: String): Boolean;
begin
if ValidateHelpSystem then begin
Result := true;
//HelpSystem.ShowTopicHelp(JumpID, GetCurrentHelpFile);
//HelpSystem.ShowHelp(Keyword, GetCurrentHelpFile);
end else
Result := false;
end;
@ -957,11 +953,7 @@ end;
------------------------------------------------------------------------------}
function TApplication.HelpKeyword(const Keyword: String): Boolean;
begin
if ValidateHelpSystem then begin
Result := true;
//HelpSystem.ShowHelp(Keyword, GetCurrentHelpFile);
end else
Result := false;
Result:=HelpKeyword(nil,Point(0,0),Keyword);
end;
{------------------------------------------------------------------------------
@ -1400,10 +1392,9 @@ begin
end;
{------------------------------------------------------------------------------
procedure TApplication.IntfEndSession();
procedure TApplication.IntfEndSession;
------------------------------------------------------------------------------}
procedure TApplication.IntfEndSession();
procedure TApplication.IntfEndSession;
begin
if Assigned(FOnEndSession) then FOnEndSession(Self);
end;
@ -1411,7 +1402,6 @@ end;
{------------------------------------------------------------------------------
procedure TApplication.IntfQueryEndSession(var Cancel : Boolean);
------------------------------------------------------------------------------}
procedure TApplication.IntfQueryEndSession(var Cancel : Boolean);
begin
if Assigned(FOnQueryEndSession) then FOnQueryEndSession(Cancel);

View File

@ -1666,6 +1666,39 @@ begin
end;
end;
{------------------------------------------------------------------------------
procedure TCustomForm.IntfHelp(AComponent: TComponent);
Show help for control or menu item.
This function is called by the interface.
------------------------------------------------------------------------------}
procedure TCustomForm.IntfHelp(AComponent: TComponent);
var
AControl: TControl;
begin
if AComponent is TControl then begin
AControl:=TControl(AComponent);
repeat
if AControl.HelpType=htContext then begin
if AControl.HelpContext<>0 then begin
Application.HelpContext(Self,AControl.ClientToScreen(Point(0,0)),
AControl.HelpContext);
exit;
end;
end else begin
if AControl.HelpKeyword<>'' then begin
Application.HelpKeyword(Self,AControl.ClientToScreen(Point(0,0)),
AControl.HelpKeyword);
exit;
end;
end;
AControl:=AControl.Parent;
until AControl=nil;
end else begin
DebugLn('TCustomForm.IntfHelp TODO help for ',DbgSName(AComponent));
end;
end;
{------------------------------------------------------------------------------
Method: TCustomForm.CreateWnd
Params: None
@ -2003,4 +2036,4 @@ begin
if Owner is TControl then
TControl(Owner).RemoveAllHandlersOfObject(Self);
inherited Destroy;
end;
end;