AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

EventName in For-Schleife ändern

Ein Thema von Johannes013 · begonnen am 26. Aug 2009 · letzter Beitrag vom 27. Aug 2009
 
Benutzerbild von turboPASCAL
turboPASCAL

Registriert seit: 8. Mai 2005
Ort: Sondershausen
4.274 Beiträge
 
Delphi 6 Personal
 
#6

Re: EventName in For-Schleife ändern

  Alt 26. Aug 2009, 17:48
Also:

Delphi-Quellcode:
for i:=0 to 10 do
  begin
    Lab:=TLabel.Create(self);
    Lab.Parent:=Form1;
    Lab.Caption:='Caption '+IntToStr(i);
    Lab.Top:=i*15;
    Lab.Show;
    Lab.Name:='Lab'+IntToStr(i);
    Lab.OnMouseMove:=LabMove;
  end;
end;
würde ich ändern in:

Delphi-Quellcode:
for i:=0 to 10 do
  begin
    Lab:=TLabel.Create(self);
    Lab.Parent:=Form1;
    Lab.Caption:='Caption '+IntToStr(i);
    Lab.Top:=i*15;
    Lab.Show;
    Lab.Tag := i; // <--<<
    Lab.OnMouseMove:= OnLabMove;
  end;
end;
...und das dann so:
Delphi-Quellcode:
procedure FormXYZ.OnLabMove(Sender: TObject);
begin
  if Sender is TLabel then
    if TLabel(Sender).Tag = 2 then exit;
end;
Matti
Meine Software-Projekte - Homepage - Grüße vom Rüsselmops -Mops Mopser
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 23:01 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz