TTMSFNCGRid Filters, CheckBox columns and selecting Rows

Hi,

I've got an issue solving this problem.
I've got a TTMSFNCGrid with a few checkbox columns.
These columns are read-only.
I use CheckBoxState to (un)check each checkbox depending on the value in the corresponding cell. This works perfect.

When I apply a filter, the checkboxes disappear and get replaced by the string values TRUE or FALSE.

To solve this, I tried to go over every row after filtering and setting the correct Booleans property for each checkbox cell.
This displays the checkboxes again, but messes up the appearance (the cell borders are gone) and ignores the fact that the column is read-only.

Also, after filtering, I cannot get the data from the selected row.
If I click the first visible row after filtering, the grid gives the data from the actual first row (which is now invisible due to the filter).

Can anyone help me fix this?
I've attached a small test project.

Thanks!

FilterTestProject.zip (84.5 KB)

Hi,

Please configure the column with the following code

  Grid1.AddCheckBoxColumn(2);
  Grid1.AddDataCheckBoxColumn(3);

Hi Pieter,

I tried adding the code.
Unfortunately this did not resolve the problem.
Now the cell borders in both columns are gone and both columns ignore the read-only property.

TestProject.zip (79.0 KB)
I've modified the project.

Hi Pieter,

I see, you actively work around the borders vanishing and set the border color in the GetCellLayout event handler.

Unfortunately, both columns are still editable. They should be read-only.
I managed to work around the problem by adding this code:

procedure TForm3.Grid1GetCellReadOnly(Sender: TObject; ACol, ARow: Integer; var AReadOnly: Boolean);
begin
if ACol in [2,3] then
AReadOnly := true;
end;

All this works but I have the feeling that the grid should handle all this automatically instead of having to implement work-arounds for layout and read-only issues.

Do you also have way to get the right data from grid after a row or cell is clicked after the filter is applied?

Hi,

To access the data after filtering, please use the AllCells property.