Skip to content

Commit ad52dd3

Browse files
committed
fix: conflicting grid edit shortcuts
a) prefer the locale independent KeyToShortCut over TextToShortcut b) in AnyGridKeyDown, do not edit if user is pressing Ctrl Refs #2284
1 parent 4c6204a commit ad52dd3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

source/main.pas

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10623,9 +10623,9 @@ procedure TMainForm.AnyGridKeyDown(Sender: TObject; var Key: Word; Shift: TShift
1062310623
Key := 0;
1062410624
end;
1062510625
end;
10626-
VK_RETURN: if Assigned(g.FocusedNode) then g.EditNode(g.FocusedNode, g.FocusedColumn);
10627-
VK_DOWN: if g.FocusedNode = g.GetLast then actDataInsertExecute(actDataInsert);
10628-
VK_NEXT: if (g = DataGrid) and (g.FocusedNode = g.GetLast) then actDataShowNext.Execute;
10626+
VK_RETURN: if Assigned(g.FocusedNode) and (Shift=[]) then g.EditNode(g.FocusedNode, g.FocusedColumn);
10627+
VK_DOWN: if (g.FocusedNode = g.GetLast) and (Shift=[]) then actDataInsertExecute(actDataInsert);
10628+
VK_NEXT: if (g = DataGrid) and (g.FocusedNode = g.GetLast) and (Shift=[]) then actDataShowNext.Execute;
1062910629
end;
1063010630
end;
1063110631

@@ -10656,8 +10656,8 @@ procedure TMainForm.AnyGridEdited(Sender: TBaseVirtualTree; Node:
1065610656
begin
1065710657
// Reassign Esc to "Cancel row editing" action
1065810658
if ([tsEditing, tsEditPending] * Sender.TreeStates) = [] then begin
10659-
actDataCancelChanges.ShortCut := TextToShortcut('Esc');
10660-
actDataPostChanges.ShortCut := TextToShortcut('Ctrl+Enter');
10659+
actDataCancelChanges.ShortCut := KeyToShortCut(VK_ESCAPE, []);
10660+
actDataPostChanges.ShortCut := KeyToShortCut(VK_RETURN, [ssCtrl]);
1066110661
FGridEditFunctionMode := False;
1066210662
end;
1066310663
end;
@@ -10666,8 +10666,8 @@ procedure TMainForm.AnyGridEditCancelled(Sender: TBaseVirtualTree; Column:
1066610666
TColumnIndex);
1066710667
begin
1066810668
// Reassign Esc to "Cancel row editing" action
10669-
actDataCancelChanges.ShortCut := TextToShortcut('Esc');
10670-
actDataPostChanges.ShortCut := TextToShortcut('Ctrl+Enter');
10669+
actDataCancelChanges.ShortCut := KeyToShortCut(VK_ESCAPE, []);
10670+
actDataPostChanges.ShortCut := KeyToShortCut(VK_RETURN, [ssCtrl]);
1067110671
end;
1067210672

1067310673
procedure TMainForm.AnyGridCreateEditor(Sender: TBaseVirtualTree; Node:

0 commit comments

Comments
 (0)