I thought I give you and update. The suggestion worked perfectly. I also thought I'd supply some code as an example as other users have asked about implementing an undo.
{Add the following variable to your form's variables, after the form variable}
{This is needed to check and see if the NextGrid has changed between the }
{NextGrid1BeforeEdit and the NextGrid1AcceptEdit events}
var
Form1: TForm1;
LastValue: WideString;
{Use the following events...}
procedure TForm1.NextGrid1BeforeEdit(Sender: TObject; ACol, ARow: Integer;
var Accept: Boolean; var Text: WideString);
begin
{Set to accept changes to the NextGrid by default}
Accept := True;
{Save the value of the cell to the variable before any changes.}
{This is for testing for saving an undo AND to test for a change to the Grid}
LastValue := Text;
{Place other tests before the editing of the NextGrid here...}
{Example}
{This example prevents editing if the user selects Col1 and there is no text in the Row on Col2}
if (NextGrid1.SelectedCol = 1) AND (NextGrid1.Cells[2, NextGrid1.SelectedRow] = '') then
begin
Accept := False;
end
else
begin
Accept := True;
end;
End;
procedure TForm1.NextGrid1AcceptEdit(Sender: TObject; ACol, ARow: Integer;
var Text: WideString; var Accept, CanLeave: Boolean);
begin
{Here we save the undo if the user accepts the change}
{Here we test to see if there was a change using the 'LastValue' variable}
If (LastValue <> Text) Then
begin
{Here you call your save undo procedure, or place the code here}
SaveUndo;
{Reset the 'LastValue' variable for the next time}
LastValue := '';
end;
end;
procedure TForm1.NextGrid1AfterEdit(Sender: TObject; ACol, ARow: Integer;
Value: WideString);
begin
{Here you place whatever the code you want that is changing the NextGrid}
{Since this event fires AFTER the 'NextGrid1AcceptEdit' event, you can undo or revert back by calling a REDO procedure}
{Example}
{This tests to see if the user has selected Col2 AND there is a value in the Row of Col2, then it places a check in Col0}
If (NextGrid1.SelectedCol = 2) AND (NextGrid1.Cells[2, NextGrid1.SelectedRow] <> '') then
begin
NextGrid1.Cell[0, NextGrid1.SelectedRow].AsBoolean := True;
end;
end;