Autor Beitrag
Cookie007
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 96

win2000 / Xp / Linux9.3
Delphi7
BeitragVerfasst: Mi 14.03.07 19:55 
Hallo leute,

Ich würde gerne ein Array vo einigen Shapes erstellen,
jedoch weiß ich nicht mehr welches wort ich verwenden muss Danke
ausblenden Delphi-Quelltext
1:
:Array [0..1] of *********					

THX Cookie 007

_________________
Mein System : A64 2400 Clawhammer, 1534 MB Ram, 200GB Festplatte, GeForce 6600 (Gigabyte)
Warum so ein langes Gesicht auf jede Frage gibt es eine Antwort, du musst sie nur suchen.(suchfunktion)
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mi 14.03.07 19:56 
ausblenden Delphi-Quelltext
1:
ShapeArray: array[0..1] of TShape;					

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Cookie007 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 96

win2000 / Xp / Linux9.3
Delphi7
BeitragVerfasst: Mi 14.03.07 20:01 
soweit war ich auch schon er sagt aber "Undeclared identifier: Shape1"
warum?
und wie kann ich es beheben
danke cookie007

_________________
Mein System : A64 2400 Clawhammer, 1534 MB Ram, 200GB Festplatte, GeForce 6600 (Gigabyte)
Warum so ein langes Gesicht auf jede Frage gibt es eine Antwort, du musst sie nur suchen.(suchfunktion)
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mi 14.03.07 20:05 
user profile iconCookie007 hat folgendes geschrieben:
soweit war ich auch schon er sagt aber "Undeclared identifier: Shape1"
warum?
und wie kann ich es beheben
danke cookie007

Code? Der Code oben produziert garantiert nicht solche Fehlermeldung.

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Cookie007 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 96

win2000 / Xp / Linux9.3
Delphi7
BeitragVerfasst: Mi 14.03.07 20:07 
ausblenden Delphi-Quelltext
1:
2:
3:
 Const Pin :Array [0..3] of Byte = (0,1,2,3);
       farbe :Array [0..1] of TColor =(clgray,clyellow );
       shape :Array [0..7] of TShape = (Shape1, Shape2, Shape3, Shape4, Shape5, Shape6, Shape7, Shape8)


bitteschön und danke schon mal

_________________
Mein System : A64 2400 Clawhammer, 1534 MB Ram, 200GB Festplatte, GeForce 6600 (Gigabyte)
Warum so ein langes Gesicht auf jede Frage gibt es eine Antwort, du musst sie nur suchen.(suchfunktion)
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mi 14.03.07 20:10 
user profile iconCookie007 hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
2:
3:
 Const Pin :Array [0..3] of Byte = (0,1,2,3);
       farbe :Array [0..1] of TColor =(clgray,clyellow );
       shape :Array [0..7] of TShape = (Shape1, Shape2, Shape3, Shape4, Shape5, Shape6, Shape7, Shape8)


bitteschön und danke schon mal

Das geht ja auch so nicht:
ausblenden Delphi-Quelltext
1:
shape :Array [0..7] of TShape = (Shape1, Shape2, Shape3, Shape4, Shape5, Shape6, Shape7, Shape8)					

Shape1 usw. sind ja nicht als TShape deklariert. Du musst diese zur Laufzeit dynamisch erzeugen.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
for i := 1 to 7 do
begin
 shape[i] := TShape.Create(Self);
 shape[i].name := 'Shape' + inttostr(i);
 //usw-
end;

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Cookie007 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 96

win2000 / Xp / Linux9.3
Delphi7
BeitragVerfasst: Mi 14.03.07 20:16 
andere Frage gibt es die möglichkeit
ausblenden Delphi-Quelltext
1:
2:
3:
var x:Integer;
X := 5
shape(x)

Wenn ja wär schön würde alles um vles erleichtern
THX Cookie 007

_________________
Mein System : A64 2400 Clawhammer, 1534 MB Ram, 200GB Festplatte, GeForce 6600 (Gigabyte)
Warum so ein langes Gesicht auf jede Frage gibt es eine Antwort, du musst sie nur suchen.(suchfunktion)
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mi 14.03.07 20:18 
user profile iconCookie007 hat folgendes geschrieben:
andere Frage gibt es die möglichkeit
ausblenden Delphi-Quelltext
1:
2:
3:
var x:Integer;
X := 5
shape(x)

Wenn ja wär schön würde alles um vles erleichtern
THX Cookie 007

Was soll den shape(x)? :gruebel:
Meinst du shape[x] ?

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Mi 14.03.07 20:19 
ausblenden Delphi-Quelltext
1:
TShape(FindComponent('Shape' + IntToStr(X))).Color					

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mi 14.03.07 20:22 
user profile iconGTA-Place hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
TShape(FindComponent('Shape' + IntToStr(X))).Color					

Das ginge auch. Aber mir ist noch nicht so richtig klar, was dieses shape(x) soll. Bis jetzt scheint er ja noch keine Objekte mit den Namen Shape1 usw. erstellt zu haben...

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Mi 14.03.07 20:42 
Ich glaube schon, er wollte das Array nur, um auf die einzelnen Shapes per Zahl zugreifen zu können.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Cookie007 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 96

win2000 / Xp / Linux9.3
Delphi7
BeitragVerfasst: Do 15.03.07 16:12 
Richtig,
Ich habe bereits Shapes und zwar von 1-8 ich will nun aber nicht immer Shape2 etc. schreiben sondern das x als variable nehmen die dann das Shape findet
ausblenden Delphi-Quelltext
1:
2:
3:
4:
var x: integer;
x := 5

Shape(x).brush.color // nun sollte shape 5 gemeint sein

_________________
Mein System : A64 2400 Clawhammer, 1534 MB Ram, 200GB Festplatte, GeForce 6600 (Gigabyte)
Warum so ein langes Gesicht auf jede Frage gibt es eine Antwort, du musst sie nur suchen.(suchfunktion)
Cookie007 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 96

win2000 / Xp / Linux9.3
Delphi7
BeitragVerfasst: Do 15.03.07 16:26 
ich habe den obige ratschlag ausprobiert jedoch gibt er eine fehlermeldung aus nach dem er findcomponent
nicht erkennt

THX Cookie 007

_________________
Mein System : A64 2400 Clawhammer, 1534 MB Ram, 200GB Festplatte, GeForce 6600 (Gigabyte)
Warum so ein langes Gesicht auf jede Frage gibt es eine Antwort, du musst sie nur suchen.(suchfunktion)
Cookie007 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 96

win2000 / Xp / Linux9.3
Delphi7
BeitragVerfasst: Sa 17.03.07 12:53 
sorry leute aber hat irgendwer einen plan
ich hab nähmlich ein bisschen zeitdruck
THX cookie007

_________________
Mein System : A64 2400 Clawhammer, 1534 MB Ram, 200GB Festplatte, GeForce 6600 (Gigabyte)
Warum so ein langes Gesicht auf jede Frage gibt es eine Antwort, du musst sie nur suchen.(suchfunktion)
Xion
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
EE-Maler
Beiträge: 1952
Erhaltene Danke: 128

Windows XP
Delphi (2005, SmartInspect), SQL, Lua, Java (Eclipse), C++ (Visual Studio 2010, Qt Creator), Python (Blender), Prolog (SWIProlog), Haskell (ghci)
BeitragVerfasst: Sa 17.03.07 12:57 
nehm doch das array, damit gehts so: Shape[x].brush.color

_________________
a broken heart is like a broken window - it'll never heal
In einem gut regierten Land ist Armut eine Schande, in einem schlecht regierten Reichtum. (Konfuzius)
Cookie007 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 96

win2000 / Xp / Linux9.3
Delphi7
BeitragVerfasst: Sa 17.03.07 13:07 
aber er muss wissen welches Array
also irgendwie so:

ausblenden Delphi-Quelltext
1:
 Shape(ARRAYNAME[ARRAYSTELLE])					

so akzeptiert er es aber nicht

_________________
Mein System : A64 2400 Clawhammer, 1534 MB Ram, 200GB Festplatte, GeForce 6600 (Gigabyte)
Warum so ein langes Gesicht auf jede Frage gibt es eine Antwort, du musst sie nur suchen.(suchfunktion)
Xion
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
EE-Maler
Beiträge: 1952
Erhaltene Danke: 128

Windows XP
Delphi (2005, SmartInspect), SQL, Lua, Java (Eclipse), C++ (Visual Studio 2010, Qt Creator), Python (Blender), Prolog (SWIProlog), Haskell (ghci)
BeitragVerfasst: Sa 17.03.07 13:13 
nee, du nimmst dein array von oben:

var Shape: array [1..100] of TShape;

dann musst sie irgendwo createn

und dann kannst per Shape[5].Brush.Color drauf zugreifen

//EDIT:
bei FindComponent musst erst noch ne Unit einfügen:Classes
und probier mal, ob da nicht eckige Klammern hingehören:
TShape[FindComponent('Shape' + IntToStr(X))].Color

//EDIT:
ggf. muss da noch Form1 davor (oder wie auch immer deine Form heißt)
TShape(Form1.FindComponent('Shape' + IntToStr(X))).Color

Xion

_________________
a broken heart is like a broken window - it'll never heal
In einem gut regierten Land ist Armut eine Schande, in einem schlecht regierten Reichtum. (Konfuzius)
Cookie007 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 96

win2000 / Xp / Linux9.3
Delphi7
BeitragVerfasst: Sa 17.03.07 13:19 
Zitat:
Das geht ja auch so nicht:
ausblenden anzeigen Delphi-Quelltext
ausgeblendet markieren
1:

shape :Array [0..7] of TShape = (Shape1, Shape2, Shape3, Shape4, Shape5, Shape6, Shape7, Shape8)

Shape1 usw. sind ja nicht als TShape deklariert. Du musst diese zur Laufzeit dynamisch erzeugen.
ausblenden anzeigen Delphi-Quelltext
ausgeblendet markieren
1:
2:
3:
4:
5:
6:

for i := 1 to 7 do
begin
shape[i] := TShape.Create(Self);
shape[i].name := 'Shape' + inttostr(i);
//usw-
end;

weißt du wie das genau mitdem in der laufzeit generieren geht
wenn ja kannste mir etw. Quelltext mit zitaten geben?

THX cookie 007

_________________
Mein System : A64 2400 Clawhammer, 1534 MB Ram, 200GB Festplatte, GeForce 6600 (Gigabyte)
Warum so ein langes Gesicht auf jede Frage gibt es eine Antwort, du musst sie nur suchen.(suchfunktion)
Xion
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
EE-Maler
Beiträge: 1952
Erhaltene Danke: 128

Windows XP
Delphi (2005, SmartInspect), SQL, Lua, Java (Eclipse), C++ (Visual Studio 2010, Qt Creator), Python (Blender), Prolog (SWIProlog), Haskell (ghci)
BeitragVerfasst: Sa 17.03.07 13:24 
klar ;)

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
for X:= 0 to High(Shape) do  //eine for schleife durch das gesamte array durch
 begin
  Shape[X]:=TShape.Create(Form);  //Das Shape wird "erschaffen"
  Shape[X].Parent:=Form;  //Ein Parent wird gesetzt, damit es weiß, wo es angezeigt werden soll
  Shape[X].Width:=20; //Werte ändern
  Shape[X].Height:=20;
  Shape[X].Left:=20*(X-1);
  Shape[X].Top:=0;
  Shape[X].Color:=clBlue;  
 end

_________________
a broken heart is like a broken window - it'll never heal
In einem gut regierten Land ist Armut eine Schande, in einem schlecht regierten Reichtum. (Konfuzius)
Cookie007 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 96

win2000 / Xp / Linux9.3
Delphi7
BeitragVerfasst: Sa 17.03.07 13:33 
brauche ich für jedes shape (wegen der verschiedenen plätze auf der form) eine eigenen Schleife ?
oder kann ich die werte während der schleife ändern ?

_________________
Mein System : A64 2400 Clawhammer, 1534 MB Ram, 200GB Festplatte, GeForce 6600 (Gigabyte)
Warum so ein langes Gesicht auf jede Frage gibt es eine Antwort, du musst sie nur suchen.(suchfunktion)