TcxGrid最左邊出現複選框
步驟(控制元件TQuery,TcxGrid,TdataSource)
1.在sql builder中
SELECT '0' abc, OrderNo, ItemNo, PartNo, Qty, Discount FROM "items.db" Items
abc就是複選框那一列
2.點選Views,在彈出的對話方塊中選擇abc一項
3.在左下角的配置如下:
properties------------->checkbox
------valuechecked --------->1
--type----->string
------valueUnchecked--------->0
--type----->string
options-------
---Editing=False
---Filtering = False
---IncSearch = False
4.CellClick事件
var
row: Integer;
begin
if View1.ViewData.RecordCount = 0 then
Exit;
row := View1.DataController.FocusedRowIndex;
if View1.ViewData.Records[row].Values[0] = '1' then
View1.ViewData.Records[row].Values[0] := '0'
else
View1.ViewData.Records[row].Values[0] := '1';
end;