Autor Beitrag
rn22
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70



BeitragVerfasst: Mi 30.11.11 01:53 
Ist mir fast peinlich, dass zu fragen, aber ich komm nicht weiter...

Ich will für ein TEdit den Druck der Tabulatortaste abfragen.
Hab mir gedacht, dass geht ganz einfach mit OnKeyDown - funktioniert aber nicht.

Wie würdet ihr da rangehen?
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mi 30.11.11 06:17 
Es gibt noch OnKeyPress.
bummi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1248
Erhaltene Danke: 187

XP - Server 2008R2
D2 - Delphi XE
BeitragVerfasst: Mi 30.11.11 08:39 
@Luckie

Tab war ein Sonderfall, wenn ich mich recht erinnere musste man sich direkt in die Messages einhängen ...


die billige Variante
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
  var Handled: Boolean);
begin
  if (msg.message=wm_keydown) and (Msg.wParam=9then ...

_________________
Das Problem liegt üblicherweise zwischen den Ohren H₂♂
DRY DRY KISS
rn22 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70



BeitragVerfasst: Mi 30.11.11 15:55 
Danke erstmal!

Ich hab mit ApplicationEvents noch nicht gearbeitet - kennt ihr ein gutes Tutorial oder könnt ihr kurz erklären, wie man die Komponente bei diesem Problem anwenden würde?
bummi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1248
Erhaltene Danke: 187

XP - Server 2008R2
D2 - Delphi XE
BeitragVerfasst: Mi 30.11.11 16:18 
Komponente TApplicationEvents aufs Hauptformular legen, OnMessage Doppelklicken und Code einfügen ....
z.B.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
begin
 if (msg.message=wm_keydown) and (Msg.wParam=9then
   if ActiveControl=Edit1 then
      begin
      TuEtwas;
      Handled := true; // Wenn Tab hier nicht mehr funktionieren soll
      end;

end;

_________________
Das Problem liegt üblicherweise zwischen den Ohren H₂♂
DRY DRY KISS
rn22 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70



BeitragVerfasst: Mi 30.11.11 16:32 
genau danach hab ich gesucht - vielen Dank!