My grid has some boolean values
which I like to toggle with a checkbox column. The state of the
checkboxes change if I click them, however, the underlying cell values
apparently do not change... I like to toggle between 0 and 1. What am I
missing?
That is true, the Editing.Enabled property is for inplace editing, which means the editor that is shown when clicking a cell. To disable editing on checkboxes please use the following code:
procedure TForm26.TMSFNCGrid1GetCellProperties(Sender: TObject; ACol,
ARow: Integer; Cell: TTMSFNCGridCell);
begin
if (Cell is TTMSFNCCheckGridCell) then
(Cell as TTMSFNCCheckGridCell).ControlEnabled := False;
end;
Thanks for your quick reply. I tried your solution, however, it doesn't work properly.
I
am contolling the edit state of the grid with a button. After setting
the edit state from TRUE to FALSE, I still can click one more time on a
checkbox. Only after the second click the checkbox is disabled.
var Form1: TForm1; bEditing: Boolean = TRUE;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.TMSFNCButton1Click(Sender: TObject); begin bEditing := FALSE; end;
procedure TForm1.TMSFNCGrid1GetCellProperties(Sender: TObject; ACol, ARow: Integer; Cell: TTMSFNCGridCell); begin if not bEditing then if (Cell is TTMSFNCCheckGridCell) then (Cell as TTMSFNCCheckGridCell).ControlEnabled := False; end;