FNCGrid Column ReadOnly

Hi,

I'm trying to make a column in a FNCGrid read-only.
If I change the Column property to "ReadOnly = True", it doesn't change the functionality during run-time.
I'm still able to edit and change the contents of the cells in that specific column.

Setting the FNCGrid.Options.Editing.Enabled to False sets the entire grid to read-only, so that is not a solution.

Is there anything I missed?
I've included a small test project.

Thanks!
TestProject.zip (13.4 KB)

Hi,

Can you try with the OnGetCellReadOnly event, or the ReadOnlys[ACol, ARow] property?

I am having this same issue too. Why does it allow editing on a column that is set in Readonly property as True when I changed the Editor to etComboBox? I need to set this base on the database USER.

Hi,

I can't reproduce this with the following code

  TMSFNCGrid1.LoadSampleData;
  TMSFNCGrid1.Columns[1].Editor := etComboBox;
  TMSFNCGrid1.Columns[1].ReadOnly := True;

I have found the issue but do not know how to resolve it.
Loading the grid from the database and setting the column color base on status of the record, changes the The column to READONLY to false. I tried to set it back using the following code after it loads, but it does matter. It is still in Readonly False for each user.
Maybe there is another way to set the background color for the Cell?
.
if (dm.FDConnection1.Params.UserName = 'SYSDBA') then
begin
SHIPITEMSGrid.ColumnS[2].ReadOnly := FALSE;
SHIPITEMSGrid.Columns[2].Editor := etcombobox;
end
else
begin
SHIPITEMSGrid.ColumnS[2].ReadOnly := True;
SHIPITEMSGrid.Columns[2].Editor := etEdit;
end;

while not fdtbl2.Eof do
begin
if fdtbl2.FieldByName('STATUS').AsString = 'Partial' then
BEGIN
SHIPPINGITEMDelete.Enabled := False;
SHIPITEMSGrid.colors[2,fdtbl2.FieldByName('SOLINEITEM').Asinteger] :=tAlphaColorRec.Yellowgreen;
fg := False;
END

You can set the background color in the OnGetCellAppearance event. Also you might consider using TTMSFNCDataGrid. We have eliminated quite a few bugs in relation to column, cell layout an appearance.

I need an example using OnGetCellAppearance event for changing the cell color base-on database user name.
Also, what type of overhead/effort to convert from fncgrid to fncdatagrid since I just got fncgrid converted from fmxlivegrid?

Thanks
Garnet

fncgrid & fncdatagrid are similar. But fncdatagrid is the better choice. here is an example to set up in relationship with a database adapter. Code can also be transformed for data grid as well.