From f2e991aa05426dbb754503bda25286fc5963e84c Mon Sep 17 00:00:00 2001 From: n7800 <14154601-n7800@users.noreply.gitlab.com> Date: Tue, 24 Jun 2025 22:31:45 +0500 Subject: [PATCH] IDE/Help: Automatically assign shortcut hints to help buttons in windows --- ide/main.pp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/ide/main.pp b/ide/main.pp index 1ad46d008c..f869955017 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -12539,6 +12539,7 @@ var HasResources: Boolean; FileItem: PStringToStringItem; lHelpButton: TControl; + lContextHelpCommand: TIDECommand; begin GetDefaultProcessList.FreeStoppedProcesses; if (SplashForm<>nil) then FreeThenNil(SplashForm); @@ -12571,9 +12572,20 @@ begin with FFormsForSetupHelpButton do if Count>0 then begin // process in idle one window at a time - if FindHelpButton(TWinControl(Extract(First)),lHelpButton) then + if FindHelpButton(TWinControl(Extract(First)),lHelpButton) then begin + // set click event if lHelpButton.OnClick=nil then lHelpButton.OnClick:=@LazarusHelp.HelpButtonClick; + // set shortcut hint + if lHelpButton.Hint='' then begin + lContextHelpCommand:=IDECommandList.FindIDECommand(ecContextHelp); + if Assigned(lContextHelpCommand) then begin + with lContextHelpCommand do + lHelpButton.Hint:=KeyValuesToCaptionStr(ShortcutA,ShortcutB); + lHelpButton.ShowHint:=true; + end; + end; + end; // free empty list if FFormsForSetupHelpButton.Count <= 0 then FreeAndNil(FFormsForSetupHelpButton);