mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-26 11:17:57 +08:00
Enable shortcuts in memo editor:
- Escape for cancel editing - Ctrl + Enter for apply text and end editing
This commit is contained in:
@ -27,5 +27,6 @@ object frmMemoEditor: TfrmMemoEditor
|
|||||||
ScrollBars = ssBoth
|
ScrollBars = ssBoth
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
WantTabs = True
|
WantTabs = True
|
||||||
|
OnKeyDown = memoTextKeyDown
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -3,7 +3,7 @@ unit memoeditor;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Windows, Classes, Graphics, Controls, Forms, StdCtrls, TntStdCtrls, Registry;
|
Windows, Classes, Graphics, Controls, Forms, StdCtrls, TntStdCtrls, Registry, VirtualTrees;
|
||||||
|
|
||||||
{$I const.inc}
|
{$I const.inc}
|
||||||
|
|
||||||
@ -12,6 +12,7 @@ type
|
|||||||
memoText: TTntMemo;
|
memoText: TTntMemo;
|
||||||
procedure FormDestroy(Sender: TObject);
|
procedure FormDestroy(Sender: TObject);
|
||||||
procedure FormShow(Sender: TObject);
|
procedure FormShow(Sender: TObject);
|
||||||
|
procedure memoTextKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||||
private
|
private
|
||||||
{ Private declarations }
|
{ Private declarations }
|
||||||
public
|
public
|
||||||
@ -58,5 +59,18 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TfrmMemoEditor.memoTextKeyDown(Sender: TObject; var Key: Word; Shift:
|
||||||
|
TShiftState);
|
||||||
|
var
|
||||||
|
Tree: TCustomVirtualStringTree;
|
||||||
|
begin
|
||||||
|
Tree := TCustomVirtualStringTree(Parent);
|
||||||
|
case Key of
|
||||||
|
// Cancel by Escape
|
||||||
|
VK_ESCAPE: Tree.CancelEditNode;
|
||||||
|
// Apply changes and end editing by Ctrl + Enter
|
||||||
|
VK_RETURN: if ssCtrl in Shift then Tree.EndEditNode;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
Reference in New Issue
Block a user