Einzelnen Beitrag anzeigen

schuetzejanett

Registriert seit: 5. Apr 2006
Ort: Fraureuth
62 Beiträge
 
#3

Re: Stringrid Zeilen hinzufügen und löschen

  Alt 22. Jan 2007, 22:20
ja ich sehe sie ja auch erhalte nur erhalte nur manchmal eine exception beim hinzufügen oder löschen

hier mal der ausschnitt des codes wo ich die stringgrids initialisiere , erstelle

Delphi-Quellcode:
private
    astringgrid: array of TStringgrid;

...

setlength(astringgrid,playerList.Count);

for j := Low(TabTitles) to High(TabTitles) do
              begin
                atabsheet[j] := TTabSheet.Create(aPageControl[i]) ;
                with atabsheet[j] do
                  begin
                    PageControl := aPageControl[i];
                    Name := 'ts' + TabTitles[j];
                    Caption := TabTitles[j];
                    astringgrid[(i*2+j)] := TStringgrid.Create(atabsheet[j]);
                    with astringgrid[(i*2+j)] do
                      begin
                        parent := atabsheet[j];
                        top:=5;
                        width := 140;
                        defaultrowheight := 15;
                        scrollbars := ssvertical;
                        if j = 0 then
                          begin
                            rowcount := 2;
                            colcount := 4;
                            fixedrows := 1;
                            defaultcolwidth := 40;
                            colwidths[0] := 20 ;
                            cells[1,0]:= '1';
                            cells[2,0]:= '2';
                            cells[3,0]:= '3';
                          end
                        else
                          begin
                            colcount := 2;
                            fixedCols := 0;
                            defaultcolwidth := 60;
                            cells[0,0]:= 'Feld';
                            cells[1,0]:= 'Treffer';
                            afields := playerList.Player[i].fields;
                            rowcount := length(afields);
                            for k := 0 to high(afields) do
                              begin
                                cells[0,k+1] := inttostr(afields[k].field);
                                Cells[1,k+1] := inttostr(afields[k].anz);
                              end;//for
                          end;//else
                      end;//with stringgrid(2i+1)
                  end;//atabsheet[j]
               end;//for tabtitles
und jetzt wo ich eine zeile hinzufüge

Delphi-Quellcode:
 row := (astringgrid[currentplayerID *2].rowcount);
  astringgrid[currentplayerID *2].rowcount := (row +1);
  astringgrid[currentplayerID *2].Cells[0,row-1] := inttostr(row-1);
  astringgrid[currentplayerID *2].Cells[1,row-1] := points[0];
  astringgrid[currentplayerID *2].Cells[2,row-1] := points[1];
  astringgrid[currentplayerID *2].Cells[3,row-1] := points[2];
  Mit Zitat antworten Zitat