TMS FNC GRID CANCEL EDIT

Hello,

Grid.CancelEdit seems to be not working. Based on the Dev Guide, canceledit will cancel the editing and return the cellstring to the original cellstring .

Thanks!

Please explain more in detail under which circumstances CancelEdit is not working?

Hello, I tried on celleditsetdata and on celleditvalidatedata. I am using FNC Grid 1.0.7.0

procedure TForm1.TMSFNCGrid1CellEditSetData(Sender: TObject; ACol,
ARow: Integer; CellEditor: TWinControl; var CellString: string);
begin
TMSFNCGrid1.CancelEdit;
end;

procedure TForm1.TMSFNCGrid1CellEditValidateData(Sender: TObject; ACol,
ARow: Integer; CellEditor: TWinControl; var CellString: string;
var Allow: Boolean);
begin
TMSFNCGrid1.CancelEdit;
end;

Please let me know if I misunderstood the method or how I can use the it. Thank you!

Hi,

The implementation is:

If the user presses ESCAPE the editing is cancelled regardless of the validation.
If the user clicks next to the cell, on another cell, the editing is cancelled when Allow := False; in the OnCellEditValidateData event.
If the user presses ENTER the editing is not cancelled when Allow := False;

The behavior is by design, using TMSFNCGrid1.CancelEdit can only be used outside of the validation events.