A THotKey is not able to hold "Tab" or "Shift+Tab" as shortcuts. Use TSynHotKey's instead in preferences dialog which doesn't have this limitation.

This commit is contained in:
Ansgar Becker
2009-09-24 18:52:35 +00:00
parent 2fd976620e
commit 445c1adefd
2 changed files with 31 additions and 15 deletions

View File

@@ -772,7 +772,6 @@ object optionsform: Toptionsform
Width = 45
Height = 13
Caption = 'Shortcut:'
Enabled = False
end
object lblShortcutHint: TLabel
Left = 199
@@ -782,7 +781,6 @@ object optionsform: Toptionsform
Anchors = [akLeft, akTop, akRight, akBottom]
AutoSize = False
Caption = 'Please select a shortcut item in the tree.'
Enabled = False
WordWrap = True
end
object lblShortcut2: TLabel
@@ -791,7 +789,6 @@ object optionsform: Toptionsform
Width = 98
Height = 13
Caption = 'Secondary shortcut:'
Enabled = False
end
object TreeShortcutItems: TVirtualStringTree
Left = 3
@@ -816,28 +813,27 @@ object optionsform: Toptionsform
OnInitNode = TreeShortcutItemsInitNode
Columns = <>
end
object Shortcut1: THotKey
object Shortcut1: TSynHotKey
Left = 199
Top = 81
Width = 207
Height = 19
Enabled = False
HotKey = 0
Modifiers = []
TabOrder = 1
OnChange = Shortcut1Change
OnEnter = ShortcutEnter
OnExit = ShortcutExit
end
object Shortcut2: THotKey
object Shortcut2: TSynHotKey
Left = 199
Top = 125
Width = 207
Height = 19
Anchors = [akLeft, akTop, akRight]
Enabled = False
HotKey = 0
Modifiers = []
TabOrder = 2
OnChange = Shortcut2Change
OnEnter = ShortcutEnter
OnExit = ShortcutExit
end
end
end

View File

@@ -11,7 +11,7 @@ interface
uses
Windows, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls, ExtCtrls, SynEditHighlighter, SynHighlighterSQL,
SynEdit, SynMemo, VirtualTrees, SynEditKeyCmds, ActnList;
SynEdit, SynMemo, VirtualTrees, SynEditKeyCmds, ActnList, SynEditMiscClasses;
type
TShortcutItemData = record
@@ -110,10 +110,10 @@ type
chkDoStatistics: TCheckBox;
tabShortcuts: TTabSheet;
TreeShortcutItems: TVirtualStringTree;
Shortcut1: THotKey;
Shortcut1: TSynHotKey;
lblShortcut1: TLabel;
lblShortcutHint: TLabel;
Shortcut2: THotKey;
Shortcut2: TSynHotKey;
lblShortcut2: TLabel;
procedure FormShow(Sender: TObject);
procedure Modified(Sender: TObject);
@@ -144,6 +144,8 @@ type
procedure TreeShortcutItemsGetNodeDataSize(Sender: TBaseVirtualTree; var NodeDataSize: Integer);
procedure Shortcut1Change(Sender: TObject);
procedure Shortcut2Change(Sender: TObject);
procedure ShortcutEnter(Sender: TObject);
procedure ShortcutExit(Sender: TObject);
private
{ Private declarations }
FWasModified: Boolean;
@@ -412,6 +414,7 @@ begin
// Shortcuts
TreeShortcutItems.ReinitChildren(nil, True);
TreeShortcutItems.FocusedNode := nil;
TreeShortcutItems.OnFocusChanged(TreeShortcutItems, TreeShortcutItems.FocusedNode, NoColumn);
btnApply.Enabled := False;
screen.Cursor := crdefault;
@@ -701,7 +704,7 @@ var
begin
// Shortcut 1 changed
Data := TreeShortcutItems.GetNodeData(TreeShortcutItems.FocusedNode);
Data.Shortcut1 := (Sender as THotKey).HotKey;
Data.Shortcut1 := (Sender as TSynHotKey).HotKey;
Modified(Sender);
end;
@@ -712,8 +715,25 @@ var
begin
// Shortcut 2 changed
Data := TreeShortcutItems.GetNodeData(TreeShortcutItems.FocusedNode);
Data.Shortcut2 := (Sender as THotKey).HotKey;
Data.Shortcut2 := (Sender as TSynHotKey).HotKey;
Modified(Sender);
end;
procedure Toptionsform.ShortcutEnter(Sender: TObject);
begin
// Remove Esc and Enter shortcuts from buttons
btnOk.Default := False;
btnCancel.Cancel := False;
end;
procedure Toptionsform.ShortcutExit(Sender: TObject);
begin
// Readd Esc and Enter shortcuts to buttons
btnOk.Default := True;
btnCancel.Cancel := True;
end;
end.