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
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

View File

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