From 5eea711f78269a28e9d813c61bbbe27f757adb24 Mon Sep 17 00:00:00 2001 From: n7800 <14154601-n7800@users.noreply.gitlab.com> Date: Wed, 14 May 2025 10:06:29 +0500 Subject: [PATCH] IDE/BuildLazDialog: Added keyboard shortcuts --- ide/buildlazdialog.lfm | 11 +++++++++++ ide/buildlazdialog.pas | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/ide/buildlazdialog.lfm b/ide/buildlazdialog.lfm index 85a62bcfd7..f91352aedf 100644 --- a/ide/buildlazdialog.lfm +++ b/ide/buildlazdialog.lfm @@ -10,10 +10,12 @@ object ConfigureBuildLazarusDlg: TConfigureBuildLazarusDlg ClientWidth = 700 Constraints.MinHeight = 440 Constraints.MinWidth = 550 + KeyPreview = True Position = poScreenCenter LCLVersion = '4.99.0.0' OnClose = FormClose OnCreate = FormCreate + OnKeyDown = FormKeyDown OnResize = FormResize OnShow = FormShow object CBLDBtnPanel: TPanel @@ -31,6 +33,7 @@ object ConfigureBuildLazarusDlg: TConfigureBuildLazarusDlg object CancelButton: TBitBtn Left = 612 Height = 26 + Hint = '[Esc]' Top = 6 Width = 82 Align = alRight @@ -40,29 +43,37 @@ object ConfigureBuildLazarusDlg: TConfigureBuildLazarusDlg Caption = 'Cancel' Kind = bkCancel ModalResult = 2 + ParentShowHint = False + ShowHint = True TabOrder = 4 end object SaveSettingsButton: TBitBtn Left = 512 Height = 26 + Hint = '[Ctrl+S]' Top = 6 Width = 94 Align = alRight AutoSize = True BorderSpacing.Around = 6 Caption = 'Save settings' + ParentShowHint = False + ShowHint = True TabOrder = 3 OnClick = SaveSettingsButtonClick end object CompileButton: TBitBtn Left = 302 Height = 26 + Hint = '[Ctrl+Enter]' Top = 6 Width = 71 Align = alRight AutoSize = True BorderSpacing.Around = 6 Caption = 'Compile' + ParentShowHint = False + ShowHint = True TabOrder = 1 OnClick = CompileButtonClick end diff --git a/ide/buildlazdialog.pas b/ide/buildlazdialog.pas index da45e90390..61d6a3d247 100644 --- a/ide/buildlazdialog.pas +++ b/ide/buildlazdialog.pas @@ -48,8 +48,9 @@ uses {$IFDEF Windows} Windows, {$ENDIF} + // LCL Forms, Controls, StdCtrls, ExtCtrls, Buttons, Dialogs, - LCLPlatformDef, CheckLst, Menus, ComCtrls, + LCLPlatformDef, CheckLst, Menus, ComCtrls, LCLType, // LazUtils FPCAdds, FileUtil, LazFileUtils, LazUTF8, LazLoggerBase, LazFileCache, // Codetools @@ -128,6 +129,7 @@ type procedure DefinesButtonClick(Sender: TObject); procedure FormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction); procedure FormCreate(Sender: TObject); + procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure FormResize(Sender: TObject); procedure FormShow(Sender: TObject); procedure HelpButtonClick(Sender: TObject); @@ -1287,6 +1289,40 @@ begin TargetDirectoryComboBox.DropDownCount:=EnvironmentOptions.DropDownCount; end; +procedure TConfigureBuildLazarusDlg.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); +begin + // dialog + if (Key = VK_ESCAPE) and (Shift = []) then + begin + Close; + Key := 0; + end + else if (Key = VK_RETURN) and (Shift = [ssCtrl]) then + begin + if CompileButton.Enabled then + CompileButtonClick(Sender); + Key := 0; + end + else if (Key = VK_S) and (Shift = [ssCtrl]) then + begin + if SaveSettingsButton.Enabled then + SaveSettingsButtonClick(Sender); + Key := 0; + end + + // tabs + else if (Key = VK_TAB) and (Shift = [ssCtrl]) then + begin + PageControl1.SelectNextPage(true); + Key := 0; + end + else if (Key = VK_TAB) and (Shift = [ssCtrl, ssShift]) then + begin + PageControl1.SelectNextPage(false); + Key := 0; + end +end; + procedure TConfigureBuildLazarusDlg.FormResize(Sender: TObject); begin LCLWidgetTypeComboBox.Width:=(OptionsMemo.Width - 12) div 3;