Board index » delphi » How to disable and enable cells in TStringGrid?

How to disable and enable cells in TStringGrid?

Hi,

I want to disable certain cells in TStringGrid from being edited by user and
allow some cells for data entry. Depends on certain criteria, positions of
cell for allowing and disallowing for data entry are not the same for each
row.

For example,

In row number 1, cell 1, 2 & 4 will allow for data entry but cell 3 & 5 will
stop being edited by user.

Whereas in row number 2, cell 1 & 5 will allow for data entry but cell 2, 3
& 4 will stop being edited by user.

Color of cell will also depends on the enable and disable of the cell.

Can anyone some me some sample code on how to performing this?

Thanks in advance.

Regard,
Singchee

 

Re:How to disable and enable cells in TStringGrid?


In the OnSelectCell event of the grid, you can set CanSelect to false for
those cells that you don't want to user to be able to edit.

Re:How to disable and enable cells in TStringGrid?


Thanks John, it works!

Regards,
Singchee

Quote
John Donnelly wrote in message <391025a9@dnews>...
>In the OnSelectCell event of the grid, you can set CanSelect to false for
>those cells that you don't want to user to be able to edit.

Other Threads