activated auto complete from search history + shc editor hint

This commit is contained in:
Basile Burg 2016-03-13 20:11:13 +01:00
parent 461b5e0c5c
commit 612d9afcd0
3 changed files with 15 additions and 5 deletions

View File

@ -22,6 +22,8 @@ inherited CESearchWidget: TCESearchWidget
Top = 4 Top = 4
Width = 391 Width = 391
Align = alTop Align = alTop
AutoComplete = True
AutoCompleteText = [cbactEnabled, cbactEndOfLineComplete, cbactSearchCaseSensitive, cbactSearchAscending]
AutoSize = False AutoSize = False
BorderSpacing.Around = 4 BorderSpacing.Around = 4
ItemHeight = 0 ItemHeight = 0
@ -251,6 +253,8 @@ inherited CESearchWidget: TCESearchWidget
Width = 283 Width = 283
Align = alClient Align = alClient
Anchors = [akTop, akLeft, akBottom] Anchors = [akTop, akLeft, akBottom]
AutoComplete = True
AutoCompleteText = [cbactEnabled, cbactEndOfLineComplete, cbactSearchCaseSensitive, cbactSearchAscending]
ItemHeight = 0 ItemHeight = 0
MaxLength = 128 MaxLength = 128
OnChange = cbReplaceWthChange OnChange = cbReplaceWthChange

View File

@ -64,7 +64,7 @@ object CEShortcutEditor: TCEShortcutEditor
Left = 0 Left = 0
Height = 22 Height = 22
Top = 2 Top = 2
Width = 258 Width = 247
Align = alClient Align = alClient
Alignment = taCenter Alignment = taCenter
BorderSpacing.Top = 2 BorderSpacing.Top = 2
@ -73,11 +73,11 @@ object CEShortcutEditor: TCEShortcutEditor
TabOrder = 0 TabOrder = 0
end end
object shortcutCatcher: TEdit object shortcutCatcher: TEdit
Left = 310 Left = 299
Height = 22 Height = 22
Hint = 'type a key combination while active' Hint = 'type a key combination while active'
Top = 2 Top = 2
Width = 109 Width = 120
Align = alRight Align = alRight
BorderSpacing.Top = 1 BorderSpacing.Top = 1
BorderSpacing.Bottom = 1 BorderSpacing.Bottom = 1
@ -89,7 +89,7 @@ object CEShortcutEditor: TCEShortcutEditor
TabOrder = 1 TabOrder = 1
end end
object btnActivate: TSpeedButton object btnActivate: TSpeedButton
Left = 285 Left = 274
Height = 22 Height = 22
Hint = 'enable shortcut capture' Hint = 'enable shortcut capture'
Top = 2 Top = 2
@ -99,7 +99,7 @@ object CEShortcutEditor: TCEShortcutEditor
OnClick = btnActivateClick OnClick = btnActivateClick
end end
object btnClear: TSpeedButton object btnClear: TSpeedButton
Left = 260 Left = 249
Height = 22 Height = 22
Hint = 'clear shortcut' Hint = 'clear shortcut'
Top = 2 Top = 2

View File

@ -263,6 +263,8 @@ begin
if tree.Selected.Data.isNil then exit; if tree.Selected.Data.isNil then exit;
// //
shortcutCatcher.Enabled := not shortcutCatcher.Enabled; shortcutCatcher.Enabled := not shortcutCatcher.Enabled;
if shortcutCatcher.Enabled then
shortcutCatcher.SetFocus;
end; end;
procedure TCEShortcutEditor.btnClearClick(Sender: TObject); procedure TCEShortcutEditor.btnClearClick(Sender: TObject);
@ -277,6 +279,7 @@ begin
fHasChanged := true; fHasChanged := true;
end; end;
// //
shortcutCatcher.Enabled := false;
updateEditCtrls; updateEditCtrls;
end; end;
@ -320,6 +323,7 @@ end;
procedure TCEShortcutEditor.updateEditCtrls; procedure TCEShortcutEditor.updateEditCtrls;
begin begin
schrtText.Caption := ''; schrtText.Caption := '';
shortcutCatcher.TextHint := '(Enter shortcut)';
// //
if tree.Selected.isNil then exit; if tree.Selected.isNil then exit;
if tree.Selected.Level = 0 then exit; if tree.Selected.Level = 0 then exit;
@ -327,6 +331,8 @@ begin
// //
schrtText.Caption := TShortcutItem(tree.Selected.Data).combination; schrtText.Caption := TShortcutItem(tree.Selected.Data).combination;
shortcutCatcher.Text := ''; shortcutCatcher.Text := '';
if schrtText.Caption <> '' then
shortcutCatcher.TextHint := '(' + schrtText.Caption + ')';
end; end;
function TCEShortcutEditor.findCategory(const aName: string; aData: Pointer): TTreeNode; function TCEShortcutEditor.findCategory(const aName: string; aData: Pointer): TTreeNode;