Thema: If Key = #107

Einzelnen Beitrag anzeigen

Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#6

AW: If Key = #107

  Alt 16. Mai 2019, 14:26
Der Unterschied ist, das eine ist der Virtuelle Tastencode, das andere der ASCII-Wert des Zeichens.
Im KeyPress bekommt man die ASCII-Werte in KeyDown/KeyUp bekommt man die virtuellen Tastencodes.

Im KeyPress kann man dementsprechend einfach abfragen:
Delphi-Quellcode:
if Key = '+then
  ...
Im KeyDown/KeyUp:
Delphi-Quellcode:
if Key = VK_ADD then
  ...
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
  Mit Zitat antworten Zitat