Delphi7 Zellen in StringGrid auswählen?

1 Antwort

Selektiere dein TStringGrid und schau im Objekt Inspektor unter Options. Dort kannst du den Wert goEditing anhängen.

Oder im Quellcode:

YourStringGrid.Options := YourStringGrid.Options + [goEditing];

Falls nur bestimmte Felder editierbar sein sollen, kannst du beim Selektieren einer Zelle (lege dir dafür einen Event Handler an) auch dynamisch mit if-else entscheiden, ob das Grid nun editierbar sein soll oder nicht.

Beispiel (die erste Zelle wäre nicht editierbar):

if (Column = 0 and Row = 0) then
  YourStringGrid.Options := YourStringGrid.Options - [goEditing]
else
  YourStringGrid.Options := YourStringGrid.Options + [goEditing];