IDE/Help: Automatically assign shortcut hints to help buttons in windows

This commit is contained in:
n7800 2025-06-24 22:31:45 +05:00
parent 2f35bfbe90
commit f2e991aa05

View File

@ -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);