TTMSFMXGrid Editing Disabled and Checkboxes


Continuing to implement features with a TTMSFMXTableView.
I have options, editting, disabled and SelectionMode set to smSingleRow. Yet when I click on a checkbox, the check mark is flipping from checked to unchecked and back. I want to use this particular grid as a read only interface and open a detail form for adding and editting.

How do I disable the checkbox?
And why isn't Options->Editting->Enabled = false enough to do so?

Scott Lynn

Given the properties you refer to, it looks like you use TTMSFMXGrid  instead of TTMSFMXTableView.

This shows how you add a readonly checkbox to the grid:

   TMSFMXGrid1.ReadOnlys[somecol,somerow] := true;

Greetings, you are correct, I accidentally asked about a tableview and not a grid. I am interested in a grid, a TTMSFMXGrid as you suggested. Is there a way to edit and rename the topic in my three recently posted questions so others searching can benefit from useful answers?

Your response isn't totally clear to me. I have a grid with checkboxes in it now. I have created the checkbox columns inside the Binding List interface following the examples in the TMS documentation. You mentioned the following lines of code:


TMSFMXGrid1.ReadOnlys[somecol,somerow] := true;

Where would I call these? And I can see what value I should pass for somecol, but I want a checkbox for every row in the grid, what would I pass for somerow?

I did see a Columns property for the grid I created, and I was surprised to see 14 columns already in there for my grid, which has 7 defined columns in the BindingList interface. The first column appears to be the empty fixed column, but I set ReadOnly to true for the next 7 and deleted the rest from the columns list and the checkboxes are still clickable.

So what does the Columns attribute of the grid do? And why can the user edit columns when Editing is disabled in the grid and ReadOnly is marked true for all columns?

(And should I put this in a new thread or can you or I edit the thread title to grid from table view)


There was no information at all you were using binding, so I cannot know this question relates to a data bound grid.

If you use a databound grid, you can

- Implement the event OnGetCellReadOnly to dynamically mark cells you want as readonly
- Set your dataset field a readonly field


OnGetCellReadOnly did the trick.
I did attempt to mark the column as read only in the DataSet, and that did not do it by itself.

It would seem like a bug that Grid->Options->Editing->Enabled = false does not do this. If you are going to allow checkboxes to be changed while Editing is disabled, shouldn't that be a separate property then under editing options such as Grid->Options->Editing->CheckBoxesEnabled?

Thank you again,

We'll investigate how to make this more clear / intuitive. In some case, yes, this is desirable, in other cases where checkboxes are just used for selecting rows in a read-only grid this isn't desirable. So, we'll think about making this more intuitive for both use-cases.