is it possible to set a TDBGrid (or TwwDBGrid) cell ReadOnly in Delphi? Currently I am fiddling around with literally greying the cell and clearing it after an edit, but it’s not very satisfactory.
Cheers, Jamie
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Specific cell or all cells in one column?
You may setup a column to read only in this way:
If you want to control a specific cell then you could try to program a “protection” scheme in the OnCellClickEvent. I guess you could even setup TDBGrid.Colums[IndexOfColumn].ReadOnly := True; in that event when a given cell should be read only. Something like:
After edit:
I’ve checked this solution and it works.
For example, if you want to edit only cells in column greater then first and their value must be 0(for be able to edit them) then the protection scheme would look like this: