Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Stringgrid (mit goRowSelect) eintrag/zeile löschen (https://www.delphipraxis.net/4706-stringgrid-mit-gorowselect-eintrag-zeile-loeschen.html)

dopeline 9. Mai 2003 10:28


Stringgrid (mit goRowSelect) eintrag/zeile löschen
 
Hallo Leutz!

Ich hab eine Tabelle (StringGrid) und will mit einem Rechtsklick auf eine Zeile (PopUPMenu-->"löschen") diese aus der tabelle entfernen. wie mache ich das?

Grüße, dopeline :dancer:

dopeline 13. Mai 2003 13:53

ok, das problem hab ich schon gelöst:
Delphi-Quellcode:
procedure GridDeleteRow(RowNumber : Integer; Grid : TStringGrid);
Var
  i : Integer;
Begin
  Grid.Row := RowNumber;
  If (Grid.Row = Grid.RowCount -1) Then
  Begin
    {On the last row}
    Grid.RowCount := Grid.RowCount - 1;
  End
  Else
  Begin
    {Not the last row}
    For i := RowNumber To Grid.RowCount - 1 Do
    Begin
      Grid.Rows[i] := Grid.Rows[i+ 1];
    End;
    Grid.RowCount := Grid.RowCount - 1;
  End;
End;

----------------------------------------------------------------------
procedure TFormHaupt.SBLoeschenClick(Sender: TObject);
begin
GridDeleteRow(StringGrid1.Row,StringGrid1);
end;
Funzt super!!

Grüße, dopeline :dancer:

Daniel B 13. Mai 2003 20:29

Hallo,

trotzdem verschiebe ich es nach VCL-Komponenten. ;)

Grüsse, Daniel :hi:


Alle Zeitangaben in WEZ +1. Es ist jetzt 06:05 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz