Delphi-PRAXiS
Seite 2 von 3     12 3      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Images Arrays zuordnen! (https://www.delphipraxis.net/112021-images-arrays-zuordnen.html)

API 13. Apr 2008 15:31

Re: Images Arrays zuordnen!
 
Zitat:

Zitat von foerster7891
äh und auch danke für deinen Lösungsvorschlag aber ich weis noch nicht mal was nen case ist

In diesem Fall empfehle ich dir eine Einführung in die Sprache Pascal für Delphi

foerster7892 13. Apr 2008 15:35

Re: Images Arrays zuordnen!
 
x:=1
y:=2
Z:=3
w:=4
auch für image1 schreiben kann image(x+4*i)

i ist die schleife for i........
0 to 6

könnt ihr mir noch kurz sagen ob das geht?

und dann noch wie ich das const array in var definiere

DeddyH 13. Apr 2008 15:39

Re: Images Arrays zuordnen!
 
Delphi-Quellcode:
FindComponent('Image' + inttostr(x+4*i))
Ein konstantes Array in einer Var definieren? :gruebel:

Oder meinst Du sowas?
Delphi-Quellcode:
var Bilder: array[0..5] of string;
begin
  Bilder[0] := 'Blau';
  Bilder[1] := 'Gruen';
  ...
end;

foerster7892 13. Apr 2008 15:44

Re: Images Arrays zuordnen!
 
var
Form1: TForm1;
array[0..5] of string;
implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
const Bilder: array[0..5] of string = ('Blau','Rot','Gruen','Gelb','Braun','Orange');
begin
{RadioButton1}
Image1.Picture.LoadFromFile(Bilder[RadioGroup1.ItemIndex] + '.bmp');
{RadioButton2}
Image2.Picture.LoadFromFile(Bilder[RadioGroup2.ItemIndex] + '.bmp');
{RadioButton3}
Image3.Picture.LoadFromFile(Bilder[RadioGroup3.ItemIndex] + '.bmp');
{RadioButton4}
Image4.Picture.LoadFromFile(Bilder[RadioGroup4.ItemIndex] + '.bmp');
end;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
close
end;

end.

so hab ich das jetzt gemacht aber das funktioniert nicht!

mkinzler 13. Apr 2008 15:57

Re: Images Arrays zuordnen!
 
Was bedeutet, funktioniert nicht?

foerster7892 13. Apr 2008 16:00

Re: Images Arrays zuordnen!
 
declaration expected but const found
und lacht mich nicht aus aber ich bin nun mal nen total noob

toms 13. Apr 2008 16:08

Re: Images Arrays zuordnen!
 
vor dem const kommt kein begin

Der.Kaktus 13. Apr 2008 16:08

Re: Images Arrays zuordnen!
 
Zitat:

Zitat von foerster7891
Delphi-Quellcode:
var
  Form1: TForm1;
  array[0..5] of string;
implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
const Bilder: array[0..5] of string = ('Blau','Rot','Gruen','Gelb','Braun','Orange');
begin
{RadioButton1}
  Image1.Picture.LoadFromFile(Bilder[RadioGroup1.ItemIndex] + '.bmp');
{RadioButton2}
  Image2.Picture.LoadFromFile(Bilder[RadioGroup2.ItemIndex] + '.bmp');
{RadioButton3}
  Image3.Picture.LoadFromFile(Bilder[RadioGroup3.ItemIndex] + '.bmp');
{RadioButton4}
  Image4.Picture.LoadFromFile(Bilder[RadioGroup4.ItemIndex] + '.bmp');
end;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
close
end;

end.
so hab ich das jetzt gemacht aber das funktioniert nicht!

Vor dem
Delphi-Quellcode:
const
das
Delphi-Quellcode:
begin
weg und nach
Delphi-Quellcode:
image4.....
auch..dann solltes es gehen!

foerster7892 13. Apr 2008 16:39

Re: Images Arrays zuordnen!
 
Danke schonmal aber es geht immer noch nicht:

Project Logiktrainer.exe raised exception class EAccessViolation with message 'Access violation at address 00403EC4 in modul 'Logiktrainer.exe'. Write of address 0057008F'. Process stopped. Use Step or Run to continue.

diese meldung kommt dann

var
Form1: TForm1;
implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
const Bilder: array[0..5] of string = ('Blau','Rot','Grün','Gelb','Braun','Orange');
begin
{RadioButton1}
Image1.Picture.LoadFromFile(Bilder[RadioGroup1.ItemIndex] + '.bmp');
{RadioButton2}
Image2.Picture.LoadFromFile(Bilder[RadioGroup2.ItemIndex] + '.bmp');
{RadioButton3}
Image3.Picture.LoadFromFile(Bilder[RadioGroup3.ItemIndex] + '.bmp');
{RadioButton4}
Image4.Picture.LoadFromFile(Bilder[RadioGroup4.ItemIndex] + '.bmp');
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
close
end;

end.

und so sieht das Programm jetzt aus

mkinzler 13. Apr 2008 16:46

Re: Images Arrays zuordnen!
 
Bei welchem Index?


Alle Zeitangaben in WEZ +1. Es ist jetzt 09:51 Uhr.
Seite 2 von 3     12 3      

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