This works, thank you.
One minor bug though.
After clicking the checkbox and it firing CheckedQuery, the grid OnCellChange reports the column changed as the incorrect index.
For example, my checkbox is column 0, and it's reporting 9 as changed which wasn't altered.
Inside CheckedQuery I am reading a value from the grid at the column index that matches the column OnCellChange is reporting as the changed column.
If I remove this, it works fine. If possible, I need to be able to read values from grid within CheckedQuery and still have OnCellChange work as expected.
procedure TFormViewForfeitPreview.ChkBoxCheckedQuery(Sender: TObject;
ACol, ARow: Integer; var Accept: Boolean);
var
i: Integer;
begin
inherited;
Accept := True;
if not(grid.Cell[ACol, ARow].AsBoolean) then
begin
for i := 0 to SelectedItems.Count -1 do
begin
if (SelectedItems.ValueFromIndex[i] <> grid.Cell[9, ARow].AsString) then
begin
ShowMessage('Items from previous dates cannot be saved with items for the current day.');
Accept := False;
Break;
end;
end;
end;
end;