AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Eigene klasse mit FindComponent

Ein Thema von c.Stetter · begonnen am 14. Dez 2007 · letzter Beitrag vom 14. Dez 2007
Antwort Antwort
c.Stetter

Registriert seit: 7. Nov 2007
20 Beiträge
 
#1

Re: Eigene klasse mit FindComponent

  Alt 14. Dez 2007, 07:00
Delphi-Quellcode:

...
  type
    TTurnierGruppen = class(TObject)
    private
      fGruppen,
      fSpieler : integer;
      fForm : TForm;
      fParent : TWinControl;
      fLeft, fTop : integer;
      aStringGrid : array of TAdvStringGrid;
      aTab : TTabSheet;
      aPageControl : TPageControl;
      aGruppenErgebnis : array of TAdvStringGrid;
...

  SetLength(aStringGrid, fGruppen);
  SetLength(aGruppenErgebnis, fGruppen);
  aPageControl := TPageControl.Create(nil);

  with aPageControl do
  begin
    Parent := fParent;
    Left := fLeft;
    Top := fTop;
    Width := 580;
    Height := 200;
    for i := 1 to fGruppen do
    begin
      aTab := TTabSheet.Create(nil);
      aTab.PageControl := aPageControl;
      aTab.Name := 'tab_Gruppe' + IntToStr(i);
      aTab.Caption := 'Gruppe ' + IntToStr(i);
      aStringGrid[j] := TAdvStringGrid.Create(nil);
      with aStringGrid[j] do
      begin
        Parent := aTab;
        Name := 'grd_Gruppe' + IntToStr(i);
        Left := 10;
        Top := 10;
        DefaultRowHeight := 20;
        DefaultColWidth := 60;
        Width := DefaultColWidth * 6;
        Height := 150;
        ColCount := fSpieler + 1;
        RowCount := fSpieler + 1;
        for k := 0 to fSpieler do
          Colors[k, k] := clBtnFace;
        OnClickCell := aGruppenClickCell;
        for m := 1 to ColCount - 1 do
          Cells[m, 0] := 'test' + IntToStr(m);
        for m := 1 to RowCount - 1 do
          Cells[0, m] := 'test' + IntToStr(m);
      end;

      aGruppenErgebnis[l] := TAdvStringGrid.Create(nil);
      with aGruppenErgebnis[l] do
      begin
        Parent := aTab ;
        Name := 'grd_GruppeErgebnis' + IntToStr(i);
        Left := aStringGrid[j].Width + 20;
        Top := 10;
        Width := 190;
        Height := 150;
        RowCount := fSpieler + 1;
        FixedRows := 1;
        ColCount := 5;
        ColWidths[0] := 60;
        ColWidths[1] := 30;
        ColWidths[2] := 30;
        ColWidths[3] := 30;
        ColWidths[4] := 30;

        DefaultRowHeight := 20;
        MergeCells(1, 0, 2, 1);
        MergeCells(3, 0, 2, 1);
        Cells[1,0] := 'Punkte';
        Cells[3,0] := 'Legs';
        for o := 1 to ColCount - 1 do
          for p := 1 to RowCount - 1 do
            cells[o, p] := '0';
      end;
    end;
  end;

...
und damit

    TAdvStringGrid(fForm.FindComponent('grd_GruppeErgebnis' + IntToStr(aPageControl.ActivePageIndex))).Cells[3, aCol] := IntToStr(veLegs); <-- hier springt er in den Quellcode rein. Ich hoffe, daß der Code soweit stimmt. Das generieren der Komponenten funktioniert einwandfrei, bis ich was eintragen will.
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 08:31 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