IDE/BuildLazDialog: Added keyboard shortcuts

This commit is contained in:
n7800 2025-05-14 10:06:29 +05:00 committed by Juha Manninen
parent ae99aee828
commit 5eea711f78
2 changed files with 48 additions and 1 deletions

View File

@ -10,10 +10,12 @@ object ConfigureBuildLazarusDlg: TConfigureBuildLazarusDlg
ClientWidth = 700 ClientWidth = 700
Constraints.MinHeight = 440 Constraints.MinHeight = 440
Constraints.MinWidth = 550 Constraints.MinWidth = 550
KeyPreview = True
Position = poScreenCenter Position = poScreenCenter
LCLVersion = '4.99.0.0' LCLVersion = '4.99.0.0'
OnClose = FormClose OnClose = FormClose
OnCreate = FormCreate OnCreate = FormCreate
OnKeyDown = FormKeyDown
OnResize = FormResize OnResize = FormResize
OnShow = FormShow OnShow = FormShow
object CBLDBtnPanel: TPanel object CBLDBtnPanel: TPanel
@ -31,6 +33,7 @@ object ConfigureBuildLazarusDlg: TConfigureBuildLazarusDlg
object CancelButton: TBitBtn object CancelButton: TBitBtn
Left = 612 Left = 612
Height = 26 Height = 26
Hint = '[Esc]'
Top = 6 Top = 6
Width = 82 Width = 82
Align = alRight Align = alRight
@ -40,29 +43,37 @@ object ConfigureBuildLazarusDlg: TConfigureBuildLazarusDlg
Caption = 'Cancel' Caption = 'Cancel'
Kind = bkCancel Kind = bkCancel
ModalResult = 2 ModalResult = 2
ParentShowHint = False
ShowHint = True
TabOrder = 4 TabOrder = 4
end end
object SaveSettingsButton: TBitBtn object SaveSettingsButton: TBitBtn
Left = 512 Left = 512
Height = 26 Height = 26
Hint = '[Ctrl+S]'
Top = 6 Top = 6
Width = 94 Width = 94
Align = alRight Align = alRight
AutoSize = True AutoSize = True
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'Save settings' Caption = 'Save settings'
ParentShowHint = False
ShowHint = True
TabOrder = 3 TabOrder = 3
OnClick = SaveSettingsButtonClick OnClick = SaveSettingsButtonClick
end end
object CompileButton: TBitBtn object CompileButton: TBitBtn
Left = 302 Left = 302
Height = 26 Height = 26
Hint = '[Ctrl+Enter]'
Top = 6 Top = 6
Width = 71 Width = 71
Align = alRight Align = alRight
AutoSize = True AutoSize = True
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'Compile' Caption = 'Compile'
ParentShowHint = False
ShowHint = True
TabOrder = 1 TabOrder = 1
OnClick = CompileButtonClick OnClick = CompileButtonClick
end end

View File

@ -48,8 +48,9 @@ uses
{$IFDEF Windows} {$IFDEF Windows}
Windows, Windows,
{$ENDIF} {$ENDIF}
// LCL
Forms, Controls, StdCtrls, ExtCtrls, Buttons, Dialogs, Forms, Controls, StdCtrls, ExtCtrls, Buttons, Dialogs,
LCLPlatformDef, CheckLst, Menus, ComCtrls, LCLPlatformDef, CheckLst, Menus, ComCtrls, LCLType,
// LazUtils // LazUtils
FPCAdds, FileUtil, LazFileUtils, LazUTF8, LazLoggerBase, LazFileCache, FPCAdds, FileUtil, LazFileUtils, LazUTF8, LazLoggerBase, LazFileCache,
// Codetools // Codetools
@ -128,6 +129,7 @@ type
procedure DefinesButtonClick(Sender: TObject); procedure DefinesButtonClick(Sender: TObject);
procedure FormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction); procedure FormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure FormResize(Sender: TObject); procedure FormResize(Sender: TObject);
procedure FormShow(Sender: TObject); procedure FormShow(Sender: TObject);
procedure HelpButtonClick(Sender: TObject); procedure HelpButtonClick(Sender: TObject);
@ -1287,6 +1289,40 @@ begin
TargetDirectoryComboBox.DropDownCount:=EnvironmentOptions.DropDownCount; TargetDirectoryComboBox.DropDownCount:=EnvironmentOptions.DropDownCount;
end; 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); procedure TConfigureBuildLazarusDlg.FormResize(Sender: TObject);
begin begin
LCLWidgetTypeComboBox.Width:=(OptionsMemo.Width - 12) div 3; LCLWidgetTypeComboBox.Width:=(OptionsMemo.Width - 12) div 3;