Einzelnen Beitrag anzeigen

michael.cohrs

Registriert seit: 11. Nov 2005
Ort: Hamburg
130 Beiträge
 
#4

AW: Checkboxen in Stringgrid

  Alt 16. Mai 2016, 12:50
Sorry, Copy-Paste Fehler , hier der richtige Source:

Delphi-Quellcode:
procedure TForm1.StringGrid1MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var iCol, iRow: Integer;
begin
  with TStringGrid(Sender) do
    if (Button = mbLeft) and Editing then
    begin
      MouseToCell(x, y, iCol, iRow);
      if (iCol > 0) and (iRow > 0) then
      begin
        if Cells[iCol, iRow] = '1then // Checked
          Cells[iCol, iRow]:= '0'
         else if Cells[iCol, iRow] = '0then // not Checked
          Cells[iCol, iRow]:= '1';
      end;
    end;
end;
Michael Cohrs
  Mit Zitat antworten Zitat