Autor Beitrag
hibbert
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1007

WinServer2003, Win XP, Linux
D6 Pers, D05
BeitragVerfasst: Sa 11.06.05 00:27 
Hi,
ich habe eine große ansammlung von Images auf meiner Form.
Nun lade ich auch noch viele einzelne Bilder in diese Images, ungefähr so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
for i := 1 to 192 do
  begin
  IF FindComponent('image'+IntToStr(i)) is Timage then
Timage(FindComponent('image'+IntToStr(i))).Picture.LoadFromFile(extractfilepath(application.ExeName)+'\data\bild.jpg');

Nun möchte ich gerne noch, das wenn der User ein Bild anklickt, dass eine aktion ausgeführt werden soll.

Kann ich das auch über diese Zählschleife machen, dem Bild also eine Aktion hinzufügen, denn bei Dynamisch erstellten Objekten geht sowas ja auch, wenn ich mich nicht irre.

MfG
hibbert

_________________
I kunnen väl svara endast ja eller nej
Om i viljen eller nej
TomT
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 116

Suse 9.1 WinXP
D6 Pers
BeitragVerfasst: Sa 11.06.05 01:04 
Hi,

So in der Art?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
Procedure Form1.Clickroutine(Sender : TObject);
begin
  (..)
end;

(..)

for i := 1 to 192 do
  begin
  IF FindComponent('image'+IntToStr(i)) is Timage then
  begin
    ( FindComponent('image'+IntToStr(i)) as TImage ).OnClick := Clickroutine;
  end;

_________________
...und da wurde mir klar, dass eine Toolbar keine Kneipe für Heimwerker ist.
hibbert Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1007

WinServer2003, Win XP, Linux
D6 Pers, D05
BeitragVerfasst: Sa 11.06.05 11:18 
Hi,
joa damit kann ich leben, ich muss zwar noch n bissel viel dran rumbasteln, aber das dürfte reichen :D

danke.

hibbert
//edit:
wie übergebe ich aber parameter an diese Procedure ?

_________________
I kunnen väl svara endast ja eller nej
Om i viljen eller nej
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: Sa 11.06.05 12:43 
Da der Prozeduraufruf nicht direkt von "deinem" Code aus geschieht, kannst du auch keine zusätzlichen Parameter übergeben. Was für Parameter willst du denn übergeben? Sender müsste eigentlich reichen.
Übrigens: 192 Images? Das geht doch bestimmt besser. Was machst du damit, wenn ich fragen darf?
hibbert Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1007

WinServer2003, Win XP, Linux
D6 Pers, D05
BeitragVerfasst: Sa 11.06.05 12:49 
ich habe ein 800x600 bild in 50x50 pixel bilder gebracht.

das ganze soll später mal zu einem spiel zusammenwachsen, doch dazu brauche ich erstmal ein kylix mit TCP :lol:

_________________
I kunnen väl svara endast ja eller nej
Om i viljen eller nej
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: Sa 11.06.05 13:02 
Und wieso nimmst du jetzt nicht einfach ein Image mit 800x600? :gruebel: Was du mit 192 Images machen kannst, kannst du auch mit einem...
hibbert Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1007

WinServer2003, Win XP, Linux
D6 Pers, D05
BeitragVerfasst: Sa 11.06.05 17:01 
mhh aber der user soll in bestimmten bereichen des images bestimmtre aktionen ausführen können...

_________________
I kunnen väl svara endast ja eller nej
Om i viljen eller nej
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: Sa 11.06.05 17:14 
Ist ja nichts, was du mit einem grossen Image nicht tun kannst. In OnMouseDown kriegste direkt die X/Y Koordinate. Und auch im OnClick kannst du die Koordinate rausfinden um dann spezifische Aktionen auszuführen.