FIX: Close edit comment dialog by Escape key

This commit is contained in:
Alexander Koblov 2014-06-29 17:32:39 +00:00
commit 46cfdc4066
2 changed files with 9 additions and 1 deletions

View file

@ -68,6 +68,7 @@ object frmDescrEdit: TfrmDescrEdit
BorderSpacing.Top = 8
BorderSpacing.Right = 12
BorderSpacing.Bottom = 12
OnKeyDown = memDescrKeyDown
TabOrder = 0
end
object cbEncoding: TComboBox

View file

@ -47,6 +47,7 @@ type
procedure actExecute(Sender: TObject);
procedure cbEncodingChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure memDescrKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
private
FDescr: TDescription;
FCommands: TFormCommands;
@ -65,7 +66,7 @@ implementation
{$R *.lfm}
uses
LConvEncoding, DCStrUtils, uHotkeyManager, uLng, uGlobs;
LCLType, LConvEncoding, DCStrUtils, uHotkeyManager, uLng, uGlobs;
const
HotkeysCategory = 'Edit Comment Dialog';
@ -111,6 +112,12 @@ begin
btnOK.Caption := btnOK.Caption + ' (' + ShortcutsToText(Hotkey.Shortcuts) + ')';
end;
procedure TfrmDescrEdit.memDescrKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key = VK_ESCAPE then ModalResult:= btnCancel.ModalResult;
end;
procedure TfrmDescrEdit.DisplayEncoding;
var
I: Integer;