Autor Beitrag
roblpz
Hält's aus hier
Beiträge: 5



BeitragVerfasst: Di 07.06.05 19:47 
wollen in unser Form1 labels ausgeben. Die Schleife soll mehrmals durchlaufen werden, aber macht es nur ein mal und erstellt daher auch nur ein Label. Wo liegt das problem ? hat jemand eine idee.

Danke für die unterstützung!!

lg roblpz & chakkacat
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
begin
  Form1.ListBox1.clear;
 if radiobutton2.checked then //radiobutton: FIFO auswählen
   begin
      //Prozedur definieren
      for i:=0 to (StrToInt(a[0])) do
      Setlength(ausgabe,200);
        begin
        n:=n+10;
        ausgabe[i]:=Tlabel.Create(Form1);
        ausgabe[i].Parent:=Form1;
        ausgabe[i].Caption:='n';
        ausgabe[i].Height:=13+n;
        ausgabe[i].Left:=15+n;
        ausgabe[i].Top:=104;
        ausgabe[i].Visible:=True;
        end;

   end;


Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt.
Moderiert von user profile iconChristian S.: Titel geändert - Hilfe will im Forum fast jeder ;-)
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Di 07.06.05 19:53 
um dir zu helfen, sollten wir noch wissen was bei a[0] drinsteht...

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...
tobiaskr
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17



BeitragVerfasst: Mo 13.06.05 07:55 
Hallo,

in deiner Schleife führst du StrToInt(a[0]) mal Setlength(ausgabe,200) aus. Einmal ( nämlich wenn die Schleife beendet ist ) erstellst du ein Label mit der Caption 'n'.

Ich denke mal das es so besser laufen würde:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
begin  
  Form1.ListBox1.clear;  
  if radiobutton2.checked then //radiobutton: FIFO auswählen  
  begin  
    Setlength(ausgabe,200);  
    n := 0;

    //Prozedur definieren  
    for i := 0 to (StrToInt(a[0])) do  
    begin  
      n := n + 10;  
      ausgabe[i] := TLabel.Create(Form1);  
      ausgabe[i].Parent := Form1;  
      ausgabe[i].Caption := IntToStr(n);  
      ausgabe[i].Height := 13 + n;  
      ausgabe[i].Left := 15 + n;  
      ausgabe[i].Top := 104;  
      ausgabe[i].Visible := True;  
    end;  
  end;


Kann sein das noch Fehler vorhanden sind, ich hab' es nicht getestet.

Gruß Tobias