Index: lcl/grids.pas =================================================================== --- lcl/grids.pas (revision 47402) +++ lcl/grids.pas (working copy) @@ -1395,6 +1395,7 @@ property OnStartDrag; property OnTopleftChanged; property OnUTF8KeyPress; + property OnValidateEntry; end; @@ -1506,6 +1507,7 @@ property OnTopleftChanged; property OnUserCheckboxBitmap; property OnUTF8KeyPress; + property OnValidateEntry; end; TCustomStringGrid = class; @@ -6918,6 +6920,13 @@ EditorShow(True); Key := 0; end; + VK_ESCAPE: + begin + TCustomEdit(Editor).Text:=FEditorOldValue; + EditorHide; +// InvalidateCell(FCol,FRow,True); + Key := 0; + end; end; if FEditorKey and (not PreserveRowAutoInserted) then FRowAutoInserted:=False; @@ -7609,7 +7618,7 @@ and (Editor<>nil) and Editor.Visible then begin if validate then begin - CurValue := GetCells(FCol,FRow); + CurValue := TCustomEdit(Editor).Text; NewValue := CurValue; result := ValidateEntry(FCol,FRow,FEditorOldValue,NewValue); if (CurValue<>NewValue) then begin @@ -9841,6 +9850,7 @@ begin result:=''; if assigned(OnGetEditText) then OnGetEditText(self, aCol, aRow, Result); + FEditorOldValue:=Result; end; procedure TCustomDrawGrid.GridMouseWheel(shift: TShiftState; Delta: Integer);