Autor Beitrag
Josef-B
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 293

2003 Server, Win7, Win8
Delphi 2010 Pro, Firebird 2.5
BeitragVerfasst: Mo 25.01.10 11:16 
Hallo ich möchte angezeigt bekommen, welches Objekt ein Ereignis ausgelöst hat

ausblenden Delphi-Quelltext
1:
2:
3:
4:
if (key=VK_Return) then
  begin
  showmessage(> hier soll der Sender anzeigt werden >)
  end;


Also den Sender als string anzeigen?
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 25.01.10 11:23 
ausblenden Delphi-Quelltext
1:
2:
if Sender is TComponent then
  ShowMessage(TComponent(Sender).Name);
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Mo 25.01.10 11:23 
Suchst du Sender.Name ?

Edit: Ach stimmt, vorher nen Typecast..

_________________
PROGRAMMER: A device for converting coffee into software.
Tilman
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1405
Erhaltene Danke: 51

Win 7, Android
Turbo Delphi, Eclipse
BeitragVerfasst: Mo 25.01.10 11:26 
Das kannst du so machen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
if (key=VK_Return) then
  begin
  showmessage((sender as tControl).name)
  end;


wenn du unterschiedlich reagieren willst, je nach dem welche Komponente der Sender ist, dann setze lieber die Eigenschaft "Tag" der Komponente auf einen Wert. Du kannst dann mit
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
case (sender as TComponent).tag of
1: bla;
2: blup;
3: blop;
end;

arbeiten.

_________________
Bringe einen Menschen zum grübeln, dann kannst du heimlich seinen Reis essen.
(Koreanisches Sprichwort)
Josef-B Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 293

2003 Server, Win7, Win8
Delphi 2010 Pro, Firebird 2.5
BeitragVerfasst: Mo 25.01.10 11:40 
Super,

danke für Eure sehr schnellen Antworten

8)