LazStats: Fix help callback to be usable for the help context assigned to menu items.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7472 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-05-26 17:42:01 +00:00
parent 23c9b29e57
commit 837521fe3d
4 changed files with 31 additions and 7 deletions

Binary file not shown.

View File

@ -298,7 +298,7 @@ object OS3MainFrm: TOS3MainFrm
object MenuItem2: TMenuItem
Caption = 'Variables'
object DefineVar: TMenuItem
Caption = 'Define'
Caption = 'Define...'
OnClick = DefineVarClick
end
object PrintDefs: TMenuItem
@ -322,14 +322,17 @@ object OS3MainFrm: TOS3MainFrm
Caption = 'Tools'
object FormatGrid: TMenuItem
Caption = 'Format Grid Cells'
HelpContext = 15
OnClick = FormatGridClick
end
object SortCases: TMenuItem
Caption = 'Sort Cases'
HelpContext = 16
OnClick = SortCasesClick
end
object PrintGrid: TMenuItem
Caption = 'Print Grid File'
HelpContext = 17
OnClick = PrintGridClick
end
object MenuItem28: TMenuItem
@ -338,6 +341,7 @@ object OS3MainFrm: TOS3MainFrm
end
object SelectCases: TMenuItem
Caption = 'Select Cases'
HelpContext = 18
OnClick = SelectCasesClick
end
object LoadSubFile: TMenuItem
@ -375,10 +379,12 @@ object OS3MainFrm: TOS3MainFrm
Caption = 'Edit'
object blockcopy: TMenuItem
Caption = 'Copy a Block of Cells'
HelpContext = 20
OnClick = blockcopyClick
end
object BlockPaste: TMenuItem
Caption = 'Paste a Block of Cells'
HelpContext = 21
OnClick = BlockPasteClick
end
object BlockCut: TMenuItem
@ -389,19 +395,23 @@ object OS3MainFrm: TOS3MainFrm
Caption = '-'
end
object InsNewCol: TMenuItem
Caption = 'Insert New Column Before Current One'
Caption = 'Insert New Column'
HelpContext = 22
OnClick = InsNewColClick
end
object CopyCol: TMenuItem
Caption = 'Copy Column'
HelpContext = 23
OnClick = CopyColClick
end
object CutCol: TMenuItem
Caption = 'Cut Column'
HelpContext = 24
OnClick = CutColClick
end
object PasteCol: TMenuItem
Caption = 'Paste Column'
HelpContext = 25
OnClick = PasteColClick
end
object MenuItem48: TMenuItem
@ -409,18 +419,22 @@ object OS3MainFrm: TOS3MainFrm
end
object NewRow: TMenuItem
Caption = 'Insert New Row'
HelpContext = 26
OnClick = NewRowClick
end
object CopyRowMenu: TMenuItem
Caption = 'Copy Row'
HelpContext = 27
OnClick = CopyRowMenuClick
end
object CutRowMenu: TMenuItem
Caption = 'Cut Row'
HelpContext = 28
OnClick = CutRowMenuClick
end
object PasteRowMenu: TMenuItem
Caption = 'Paste Row'
HelpContext = 29
OnClick = PasteRowMenuClick
end
end

View File

@ -1588,20 +1588,30 @@ end;
{$IFDEF MSWINDOWS}
// Call HTML help (.chm file)
// Is is expected that help topics are specified as HelpKeyword (HelpType = htContext).
// Using numeric HelpContext values will crash the application.
// Since the menu items provide only a HelpContext number some ticks must be
// applied to distinguish between number and string...
function TOS3MainFrm.HelpHandler(Command: Word; Data: PtrInt;
var CallHelp: Boolean): Boolean;
var
topic: UnicodeString;
res: Integer;
fn: UnicodeString;
begin
topic := Application.HelpFile + '::/' + PChar(Data);
htmlhelp.HtmlHelpW(0, PWideChar(topic), HH_DISPLAY_TOPIC, 0);
if Data < 10000 then // hopefully these are not pointers...
begin
// see: http://www.helpware.net/download/delphi/hh_doc.txt
fn := UnicodeString(Application.HelpFile);
res := htmlhelp.HtmlHelpW(0, PWideChar(fn), HH_HELP_CONTEXT, Data);
end else
begin
topic := Application.HelpFile + '::/' + PChar(Data);
res := htmlhelp.HtmlHelpW(0, PWideChar(topic), HH_DISPLAY_TOPIC, 0);
end;
// Don't call regular help
CallHelp := False;
// silence the compiler, function result not needed
Result := true;
Result := res <> 0;
end;
{$ENDIF}
{$ENDIF}