Permalink
Browse files

Restore functionality of home and end key in data grid, like it was b…

…efore recent VirtualTree update. Closes #453.
  • Loading branch information...
ansgarbecker committed Dec 23, 2018
1 parent 0f700d1 commit c46d194a07138755ec07574628d6da914b8bf026
Showing with 13 additions and 3 deletions.
  1. +13 −3 source/main.pas
@@ -8940,11 +8940,21 @@ procedure TMainForm.AnyGridKeyDown(Sender: TObject; var Key: Word; Shift: TShift
begin
g := TVirtualStringTree(Sender);
case Key of
VK_HOME: g.FocusedColumn := g.Header.Columns.GetFirstVisibleColumn(False);
VK_HOME: begin
g.FocusedColumn := g.Header.Columns.GetFirstVisibleColumn(False);
if (ssCtrl in Shift) and (g = DataGrid) then begin
// VT itself focuses the first node since v7.0
end else
Key := 0;
end;
VK_END: begin
if (ssCtrl in Shift) and (g = DataGrid) then
g.FocusedColumn := g.Header.Columns.GetLastVisibleColumn(False);
if (ssCtrl in Shift) and (g = DataGrid) then begin
actDataShowAll.Execute;
g.FocusedColumn := g.Header.Columns.Count-1;
// VT itself focuses the last node since v7.0
end else begin
Key := 0;
end;
end;
VK_RETURN: if Assigned(g.FocusedNode) then g.EditNode(g.FocusedNode, g.FocusedColumn);
VK_DOWN: if g.FocusedNode = g.GetLast then actDataInsertExecute(Sender);

0 comments on commit c46d194

Please sign in to comment.