Autor Beitrag
AlA
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 30



BeitragVerfasst: Mo 07.04.03 21:05 
Hallo Leute,

Es funkst immer nochnicht so wie es soll. Image1,Image2,Image3 sind Objekte. Ich will jetzt ein Array erstellen:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
var
   image : array[1..3] of ?????   !!!!Was für ein Datentyp kommt hinein??
   a : integer;
...
begin
  for a:=1 to 3 do
  image[a].visible:=true
...

Hat jemand eien Ahnung wie ich das managen kann? Solche Listen sind doch schneller, als wenn ich die ganzen Abrfagen: image1.visible.true;image2.visible.true;image3.visible.true;
einzeln durchführen lasse???

Ich habe dann nochmal ein anderes Array versucht:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
var
  schus :      array[1..7] of boolean;
  sx1,sy1:    array[1..7] of integer;
  d1,dsmm1: array[1..7] of real;

if schus[a] then begin 
  d1[a] :=round(sqrt((abs(x2-sx1[a] ))+(abs(y2-sy1[a] ))));
    if sm1 then begin   
     dsmm1[a] :=round(sqrt((abs(sx-sx1[a] ))+(abs(sy-sy1[a] ))));
      end;end else begin d1[a] :=220;dsmm1[a] :=220; end;


Dann will ich, dass mir Delphi die Variablen dsmm11, dsmm12.. anzeigt! Macht das Programm aber nicht! Ich erhalte für alle dsmm1x o (Null)! Warum? Hat jemand eine Idee? (ob schus[a] true oder false ist beinflusst komischer Weise nicht die Ausgabe!)

Moderiert von user profile iconAya: Code-Tags hinzugefügt.
Moderiert von user profile iconTino: Absätze formatiert und überflüssige "!" entfernt.

_________________
ala
D0P3 F!$H
Gast
Erhaltene Danke: 1



BeitragVerfasst: Mo 07.04.03 21:08 
Zur 1. Frage:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
var 
image : array[1..3] of [b]TImage[/b] 
a : integer; 
... 
begin 
for a:=1 to 3 do 
image[a].visible:=true


PS: Code-Tags machen das Ganze übersichtlicher! :wink:
AlA Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 30



BeitragVerfasst: Mo 07.04.03 21:20 
Zitat:
[Error] SpaceWars.pas(761): Type expected but '[' found

Das spuckt mir der Compiler aus! Was ist das b? Wie ist es dann wenn mein Image Explosion1, Explosion2, ... heisst?

Moderiert von user profile iconTino: Quote-Tag hinzugefügt & Absatze entfernt.

_________________
ala
D0P3 F!$H
Gast
Erhaltene Danke: 1



BeitragVerfasst: Di 08.04.03 12:29 
Sorry, ich wollte das TImage nur fett drucken lassen!

Einfach image : array[1..3] of TImage
fcg
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 360

WinXP
D3 Prof, D6 Pers
BeitragVerfasst: Di 08.04.03 17:48 
mehere images unsichtbar mache , machst du so:

ausblenden Quelltext
1:
2:
 for i:=0 to 5 do
 TImage(FindComponent('Image'+IntToStr(i))).visible:=false;


in diesem fall machst du die imges von 0 bis 5 visible=false

fcg

_________________
.: Wer für alles offen ist, kann nicht ganz dicht sein! :.