Autor Beitrag
haasler88
Hält's aus hier
Beiträge: 4



BeitragVerfasst: Fr 28.03.08 17:27 
Hallo DF!
Meine Frage ist, wie das Thema schon sagt, kann ich panels in einem array anordnen um leichter mit ihnen arbeiten zu können?? Würde micht über eine Antwort freuen.
Vielen Dank.
-Sascha
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Fr 28.03.08 18:07 
Ja.

Edit: Nagut, ich will mal nicht so sein..
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
 MyPanels: array[1..5] of TPanel;

......

MyPanels[1] := Panel1;
MyPanwls[1].Left := 0;
Sylvus
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 195



BeitragVerfasst: Fr 28.03.08 19:31 
user profile iconXentar hat folgendes geschrieben:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
 MyPanels: array[1..5] of TPanel;

......

MyPanels[1] := Panel1;
MyPanwls[1].Left := 0;


Kann man sich auch vereinfachen indem man folgendes schreibt:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
 MyPanels: array[1..5] of TPanel;
for i:=0 to High(MyPanels) do
begin
 with MyPanels[i] do
 begin
  Left:=0;
  top:=0;
  .
  .
  .
 end;
end;


Hoffe was ich geschrieben habe := true; :D Grüße Sylvus
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Fr 28.03.08 19:49 
hi, so schon eher:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
var
  MyPanels: array[1..5] of TPanel;
begin
  for i:=1 to High(MyPanels) do
  begin
    MyPanels[i] := TPanel(findcomponent('Panel' + inttostr(i)));
    with MyPanels[i] do
    begin
      Left:=0;
      top:=0;
      .
      .
      .
    end;
  end;
end;

Das Ganze sollte eigentlich funktionieren, da es sich hierbei um Klassen handelt und immer nur der Pointer übergeben wird.

mfg
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Fr 28.03.08 21:12 
Wenn wir schon dabei sind, es ganz schön zu machen:

user profile iconF34r0fTh3D4rk hat folgendes geschrieben:
hi, so schon eher:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
var
  MyPanels: array[1..5] of TPanel;
begin
  for i:=low(MyPanels) to High(MyPanels) do
  begin
    MyPanels[i] := TPanel(findcomponent('Panel' + inttostr(i)));
    if MyPanels[i] <> nil then
    begin
      with MyPanels[i] do
      begin
        Left:=0;
        top:=0;
        .
        .
        .
      end;
    end;
  end;
end;

BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Fr 28.03.08 21:21 
user profile iconXentar hat folgendes geschrieben:
Wenn wir schon dabei sind, es ganz schön zu machen:

user profile iconF34r0fTh3D4rk hat folgendes geschrieben:
hi, so schon eher:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
var
  MyPanels: array[1..5] of TPanel; //Normalerweise von 0 bis n-1!!!
  tmp: TComponent;
begin
  for i:=low(MyPanels) to High(MyPanels) do
  begin
    tmp := findcomponent('Panel' + inttostr(i));
    if not (tmp is TPanel) Then //Komponente mit Namen existiert, aber kein TPanel-Nachfahre.
      Continue;
    MyPanels[i] := TPanel(tmp);
    if MyPanels[i] <> nil then
    begin
      with MyPanels[i] do
      begin
        Left:=0;
        top:=0;
        .
        .
        .
      end;
    end;
  end;
end;


Dann bitte auch die Korrektheit durchziehen!

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Fr 28.03.08 21:59 
Ach verdammt :(
Stimmt ja, Typecasten erst nach der Überprüfung.
haasler88 Threadstarter
Hält's aus hier
Beiträge: 4



BeitragVerfasst: So 30.03.08 17:27 
also danke leute...
ich hoffe das hilft mir weiter!