Skip to content

Commit

Permalink
Add some hotkeys for focusing table filter, database tree and main ta…
Browse files Browse the repository at this point in the history
…bs. Also, add a new main menu with these actions, so the user can look up these hotkeys.
  • Loading branch information
ansgarbecker committed Sep 3, 2016
1 parent ebaafb1 commit 04877c4
Show file tree
Hide file tree
Showing 2 changed files with 139 additions and 2 deletions.
78 changes: 76 additions & 2 deletions source/main.dfm
Expand Up @@ -1514,7 +1514,7 @@ object MainForm: TMainForm
object ToolBarMainMenu: TToolBar
Left = 0
Top = 0
Width = 168
Width = 222
Height = 23
Align = alLeft
AutoSize = True
Expand Down Expand Up @@ -1557,8 +1557,16 @@ object MainForm: TMainForm
Grouped = True
MenuItem = MainMenuTools
end
object ToolButton11: TToolButton
Left = 146
Top = 0
AutoSize = True
Caption = 'Go to'
Grouped = True
MenuItem = MainMenuGoto
end
object btnHelp: TToolButton
Left = 136
Left = 186
Top = 0
Hint = 'Help topics'
AutoSize = True
Expand Down Expand Up @@ -1976,6 +1984,30 @@ object MainForm: TMainForm
Action = actPreferences
end
end
object MainMenuGoto: TMenuItem
Caption = 'Go to'
object actGotoFilter1: TMenuItem
Action = actGotoFilter
end
object actGotoDbTree1: TMenuItem
Action = actGotoDbTree
end
object actGotoTab11: TMenuItem
Action = actGotoTab1
end
object actGotoTab12: TMenuItem
Action = actGotoTab2
end
object actGotoTab31: TMenuItem
Action = actGotoTab3
end
object actGotoTab41: TMenuItem
Action = actGotoTab4
end
object actGotoTab51: TMenuItem
Action = actGotoTab5
end
end
object MainMenuHelp: TMenuItem
Caption = 'Help'
Hint = 'Help topics'
Expand Down Expand Up @@ -2808,6 +2840,48 @@ object MainForm: TMainForm
OnExecute = actSaveSynMemoToTextfileExecute
OnUpdate = ValidateControls
end
object actGotoDbTree: TAction
Category = 'Various'
Caption = 'Database tree'
ShortCut = 16452
OnExecute = actGotoDbTreeExecute
end
object actGotoFilter: TAction
Category = 'Various'
Caption = 'Table filter'
ShortCut = 16453
OnExecute = actGotoFilterExecute
end
object actGotoTab1: TAction
Category = 'Various'
Caption = 'Tab 1'
ShortCut = 16433
OnExecute = actGotoTabNumberExecute
end
object actGotoTab2: TAction
Category = 'Various'
Caption = 'Tab 2'
ShortCut = 16434
OnExecute = actGotoTabNumberExecute
end
object actGotoTab3: TAction
Category = 'Various'
Caption = 'Tab 3'
ShortCut = 16435
OnExecute = actGotoTabNumberExecute
end
object actGotoTab4: TAction
Category = 'Various'
Caption = 'Tab 4'
ShortCut = 16436
OnExecute = actGotoTabNumberExecute
end
object actGotoTab5: TAction
Category = 'Various'
Caption = 'Tab 5'
ShortCut = 16437
OnExecute = actGotoTabNumberExecute
end
end
object menuConnections: TPopupMenu
AutoHotkeys = maManual
Expand Down
63 changes: 63 additions & 0 deletions source/main.pas
Expand Up @@ -623,6 +623,22 @@ TMainForm = class(TForm)
ViewbinarydataastextinsteadofHEX2: TMenuItem;
actPreferencesData: TAction;
Datapreferences1: TMenuItem;
actGotoDbTree: TAction;
actGotoFilter: TAction;
actGotoTab1: TAction;
actGotoTab2: TAction;
actGotoTab3: TAction;
actGotoTab4: TAction;
actGotoTab5: TAction;
MainMenuGoto: TMenuItem;
actGotoFilter1: TMenuItem;
actGotoDbTree1: TMenuItem;
actGotoTab11: TMenuItem;
actGotoTab12: TMenuItem;
actGotoTab31: TMenuItem;
actGotoTab41: TMenuItem;
actGotoTab51: TMenuItem;
ToolButton11: TToolButton;
procedure actCreateDBObjectExecute(Sender: TObject);
procedure menuConnectionsPopup(Sender: TObject);
procedure actExitApplicationExecute(Sender: TObject);
Expand Down Expand Up @@ -982,6 +998,9 @@ TMainForm = class(TForm)
procedure menuDoubleClickInsertsNodeTextClick(Sender: TObject);
procedure DBtreeDblClick(Sender: TObject);
procedure editDatabaseTableFilterKeyPress(Sender: TObject; var Key: Char);
procedure actGotoDbTreeExecute(Sender: TObject);
procedure actGotoFilterExecute(Sender: TObject);
procedure actGotoTabNumberExecute(Sender: TObject);
private
// Executable file details
FAppVerMajor: Integer;
Expand Down Expand Up @@ -1330,6 +1349,50 @@ procedure TMainForm.actFullRefreshExecute(Sender: TObject);
end;


procedure TMainForm.actGotoDbTreeExecute(Sender: TObject);
begin
DBtree.SetFocus;
end;


procedure TMainForm.actGotoFilterExecute(Sender: TObject);
begin
editTableFilter.SetFocus;
end;


procedure TMainForm.actGotoTabNumberExecute(Sender: TObject);
var
i, Visibles, WantedIndex: Integer;
begin
// Set focus on tab by numeric index
if Sender = actGotoTab1 then
WantedIndex := 0
else if Sender = actGotoTab2 then
WantedIndex := 1
else if Sender = actGotoTab3 then
WantedIndex := 2
else if Sender = actGotoTab4 then
WantedIndex := 3
else if Sender = actGotoTab5 then
WantedIndex := 4;
i := 0;
Visibles := 0;
while true do begin
if i >= PageControlMain.PageCount then
Break;
if PageControlMain.Pages[i].TabVisible then begin
if Visibles = WantedIndex then begin
PageControlMain.ActivePageIndex := i;
Break;
end;
Inc(Visibles);
end;
Inc(i);
end;
end;


procedure TMainForm.actGridEditFunctionExecute(Sender: TObject);
begin
// Insert SQL function in grid
Expand Down

0 comments on commit 04877c4

Please sign in to comment.