Autor Beitrag
Starfighter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Mi 21.05.03 18:27 
Hallo Leute,

Ich hab da mal ne Frage, wie kann man ne Procedure auf eine Taste legen? Auf die "ENTF" Taste?`

Danke für jede Antword

See You

D-Eagle
TheNeon
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 408

Windows
VS2010 C#
BeitragVerfasst: Mi 21.05.03 18:47 
1. KeyPreview einschalten
2. in Form.OnKeyDown abfragen ob es sich um "Entf" handelt und dann Prozedur.Click;
G-McKree
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: Mi 21.05.03 19:13 
ich hab da so n prob, das ich n objekt mit tasten steuere, aber immer nur eine taste als gedrückt gilt
Starfighter Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Mi 21.05.03 21:13 
Hallo, Danke für die schnelle Antwort.. Ich werde es mal eben schnell testen!! :)
Starfighter Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Mi 21.05.03 21:17 
Leider klappt das nicht.. Der mit jede Taste an!! :(


ausblenden Delphi-Quelltext
1:
lol					
Terra23
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 872

Win 8
Delphi 7
BeitragVerfasst: Do 22.05.03 00:15 
Das funktioniert z.B. mit Hooks.

Such mal im Forum. URL liefere ich evtl. nach; finde das jetzt nicht.. :-)

_________________
Hasta La Victoria Siempre
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Do 22.05.03 08:40 
@Starfighter: irgendwie könnte man Dir besser helfen, Deinen Code ans Laufen zu bringen, wenn wir Deinen Code kennen würden. Also bitte mal posten!

@TheNeon: wieso eigentlich Prozedur.Click. Du musst doch nicht immer einen Button haben!

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
TheNeon
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 408

Windows
VS2010 C#
BeitragVerfasst: Do 22.05.03 11:26 
Peter Lustig hat folgendes geschrieben:

@TheNeon: wieso eigentlich Prozedur.Click. Du musst doch nicht immer einen Button haben!


Tjoa ...... hab ich mal so vorausgesetzt ;)
..... ansonsten ohne .Click :roll: :D


:wink2:
Terra23
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 872

Win 8
Delphi 7
BeitragVerfasst: Fr 23.05.03 12:49 
So definierst du Hooks:

1) Lege eine eigene Prozedur an:
ausblenden Delphi-Quelltext
1:
procedure Taste (Var Druck: TWMHotKey); Message WM_HOTKEY;					


2) Lege eine Konstante an:
ausblenden Delphi-Quelltext
1:
const Hugo=VK_SPACE					


3) Registriere deinen Hotkey in der FormCreate
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.FormCreate(Sender: TObject);
begin
RegisterHotKey(TForm1.Handle, Hugo, 0, VK_SPACE);
end;


4) Belege deine Prozedur mit Befehlen
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Taste(Var Druck: TWMHotKey);
begin
If Druck.HotKey=Hugo Then ... Else ...;
end;


5) Gebe den Speicher für den Hotkey in der FormDestroy wieder frei
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.FormDestroy(Sender: TObject);
begin
UnRegisterHotKey(TForm1.Handle, Hugo);
end;


Dann müßte das eigentlich funktionieren. Eine Liste der virtuellen Codes findest du in der Delphi-Hilfe unter dem Stichwort Virtuelle Tastencodes. Hier benutzen wir die Taste "VK_SPACE" -> Leertaste

Hoffe, es hilft dir..

///edit -> Die Taste "ENTF" hat den Hotkey VK_DELETE

_________________
Hasta La Victoria Siempre