Autor Beitrag
the.fellowship
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 19



BeitragVerfasst: Sa 11.02.06 13:57 
Hallo!
Wie kann man Tastaturbefhele in ein Program einbinden?
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Sa 11.02.06 14:01 
Du kannst z.B. jedem Eintrag im MainMenu oder im PopUpMenu (wenn du solche Sachen in deinem Programm hast) einen ShortCut zuordnen.

Ansonsten kannst du auf Tastendrücke in den Ereignissen OnKeyDown, OnKeyUp oder OnKeyPressed reagieren. Wenn du die Ereignisse der Form dafür nimmst, ist es weiterhin sinnvoll, wenn man dort KeyPreview auf true stellt.

_________________
We are, we were and will not be.
the.fellowship Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 19



BeitragVerfasst: Sa 11.02.06 14:06 
Danke für die schnelle antwort!!! Aber wenn ich jetzt eine Taste drücke (egal welche) passiert etwas, wie kann ich ein Ereignis starten, wenn nur 'A' (zum Beispiel) gedrückt wird.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Sa 11.02.06 14:15 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.KeyPress(Sender: TObject; var Key: Char);
begin
 if Key = 'A' then showmessage('Taste A gedrückt');
end;
oder
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm1.KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  case key of
    ord('A'): showmessage('Taste A gedrückt')
  end; //case
end;

_________________
We are, we were and will not be.
the.fellowship Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 19



BeitragVerfasst: Sa 11.02.06 14:18 
Vielen Dank!!!
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Sa 11.02.06 14:19 
hallo,

Einige virtuelle Tastencodes, die du auch abfragen kannst, findest du unteranderem hier ;)
the.fellowship Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 19



BeitragVerfasst: Sa 11.02.06 17:02 
DAnke, genau so eine liste habe ich gebraucht!! Aber wie muss ich das eingebn, und was von der Liste?
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Sa 11.02.06 17:12 
zum beispiel so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
 if key = VK_PAUSE then showmessage('Taste Pause gedrückt!');
end;
the.fellowship Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 19



BeitragVerfasst: Sa 11.02.06 17:14 
Danke!! Also die Bezeichnung muss ich eingeben und der HEX-Code ist unwichtig...