Mirror

Make a single cell in a TStringGrid readonly (Views: 708)


Problem/Question/Abstract:

How to make a single cell in a TStringGrid readonly

Answer:

You can use OnSetEditText event for that. Something like:

procedure TForm1.StringGrid1SetEditText(Sender: TObject; ACol, ARow: Integer; const
  Value: string);
begin
  if (ACol = 1) and (ARow = 1) then
    StringGrid1.Cells[ACol, ARow] := 'Read Only!';
end;

<< Back to main page