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.
-
Press enter on a cell to start edition. Notice the Row and Col logged to the memo from the OnKeyPress event are good.
-
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