Ich will, während dem Programm TImages Erstellen und ihnen auch Ereignisse zuteilen.
Bisher(mit googlen) sieht mein Code so aus:
Code: Alles auswählen
function erschaffeNeu:integer;
var
Bild: TImage;
aText: TLabel;
Idx:String;
Self:TComponent;
Sender:TObject;
Button:TMouseButton;
Shift:TShiftState;
x,y:LongInt;
begin
inc(anzahlnr);
Idx := InttoStr(anzahlnr);
Bild := (TImage.Create(Self));
with Bild do
begin
height := 150;
width := 100;
parent := Form1;
Picture := Form1.Standart1.Picture;
Stretch := True;
//Bild.Action := Form1.ActionList1.Actions[0];
//BEGINN
Bild.OnMouseDown := Bild1MouseDown;
Bild.OnMouseEnter := Bild1MouseEnter;
Bild.OnMouseLeave := Bild1MouseLeave;
Bild.OnMouseMove := Bild1MouseMove;
Bild.OnMouseUp := Bild1MouseUp;
//Ende
Name := 'Bild' + Idx;
end;
aText := TLabel.Create(Self);
with aText do
begin
Top := 5;
Left := 10;
parent := Form1;
Caption := 'Nr: ' + Idx;
Name := 'Text' + Idx;
end;
result := anzahlnr;
end;
Bild.OnMouseDown := Bild1MouseDown;
Bild.OnMouseEnter := Bild1MouseEnter;
Bild.OnMouseLeave := Bild1MouseLeave;
Bild.OnMouseMove := Bild1MouseMove;
Bild.OnMouseUp := Bild1MouseUp;
Jedoch klappt dieser Teil nicht.
Ich habe es auch mit Action_list versucht, aber die macht das nur bei Image.Click
Was müsste man da jetzt ändern damit das klappt ? Danke.