TMS components, latest release, Delphi XE7 64bit, MS 7 Pro 64bit.
I use an ADODataset, CommandType cmdText, Prepared true, to populate an AdbDBGrid. The query was:
select ManifestNo
,ServiceDate
,DriverID
,SiteID
,GHTCAmount
,GHTCDate
,RequestCount
,NoShowCount
,OutsideReqCount
,OutsideNoShow
,'false' as Selected
from Manifests
where (DriverID = :DriverID)
and (ServiceDate >= :ServiceDate)
and ((GHTCAmount=0) or(GHTCAmount is NULL))
I altered it to replace null values with 0:
select ManifestNo
,ServiceDate
,DriverID
,SiteID
,COALESCE(GHTCAmount,0) AS GHTCAmount
,GHTCDate
,COALESCE(RequestCount,0) AS RequestCount
,COALESCE(NoShowCount,0) AS NoShowCount
,COALESCE(OutsideReqCount,0) AS OutsideReqCount
,CAOLESCE(OutsideNoShow,0) AS OutsideNoShow
,'false' as Selected
from Manifests
where (DriverID = :DriverID)
and (ServiceDate >= :ServiceDate)
and ((GHTCAmount=0) or(GHTCAmount is NULL))
All columns are in the grid, a count of 11. The last column is set to CheckBoxField := True. It populates as unchecked.
In the original select, I was able to check / uncheck the box. After changing to use COALESCE though, the check box no longer functions.
If I set the checkbox to true in code:
if SelectButton.Caption = 'Select All' then DoSelect := true else DoSelect := false;
for i := 1 to DBAdvGrid1.TotalRowCount - 1 do
begin
DBAdvGrid1.SetCheckBoxState(10,i,DoSelect);
...
end;
then the column turns into a black box.
The grid column 10 basic values are
CheckBoxField - true
CheckFalse - N
CheckTrue - Y
Editor - edNormal
ReadOnly - false
UseLookupEditor - true
The DBAdvGrid properties are pretty much the defaults:
AutoCreateColumns - true
AutoFilterUpdate - true
AutoRemoveColumns - true
DatasetTypeAuto - true
EditPostMode - epCell
PageMode - true
The grid is read and if an item is selected, it generates an ADOCommand to update the related row in the database. The DBAdvGrid does not do the update.
Any idea as to why I can not toggle the checkbox manually, or why the column goes to a black box when set programmatically?