AdvStringGrid issue with OnKeyPress event and AdvanceOnEnter

Hi,
Windows 11
Delphi 11.2
VCL UI Pack 13.1.3.2

To reproduce create a project with a grid, a memo and use the code provided at the end.

  1. Press enter on a cell to start edition. Notice the Row and Col logged to the memo from the OnKeyPress event are good.

  2. Press enter again to complete edition. Notice that the Row and Col logged to the memo from the OnKeyPress event are wrong. The values are from the next cell selected via AdvanceOnEnter and not from the cell from which enter was pressed.

procedure TForm1.FormCreate(Sender: TObject);
begin
  AdvStringGrid1.Options := AdvStringGrid1.Options + [goEditing];
  AdvStringGrid1.Navigation.AdvanceOnEnter := True;
end;

procedure TForm1.AdvStringGrid1KeyPress(Sender: TObject; var Key: Char);
begin
  Memo1.Lines.Add(Key + ' ' + AdvStringGrid1.Row.ToString + ' ' + AdvStringGrid1.Col.ToString);
end;

Is it possible to fix this please?

Thanks

This is by design and we cannot change this behavior as this potentially would break a lot of applications of other users.
To move to the next cell, this is done from the OnKeyDown that is triggered first. Then OnKeyPress and OnKeyUp follow when the edited cell is already changed to the next cell.