List Of All Virtual Key Codes For OnKeyDown And OnKeyUp In Delphi XE6 Firemonkey On Android And IOS

Delphi XE6 Firemonkey Virtual Key CodesIf you are building any kind of cross platform app where you use the keyboard you will probably need to know the various virtual key code constants which are listed in the System.UITypes unit in Delphi XE6 Firemonkey. These key codes also apply to Delphi XE5 and AppMethod. Keys like the hardware back button on your Android device are listed here as well as arrow keys and the like. You can compare the virtual key code that you want to the Key parameter in the OnKeyUp and OnKeyDown events of each control. Keep in mind that there is also the OnTyping event which is fired on IOS in addition to the usual OnKeyUp and OnKeyDown events. If your OnKeyUp and OnKeyDown events are not working for you on IOS try OnTyping instead. To use the virtual key codes you can set up a case statement on the Key parameter on OnKeyUp and OnKeyDown. You can cancel out a key press by setting the Key parameter to 0. Also keep in mind that there is a second parameter called KeyChar in the OnKeyUp and OnKeyDown events. I have had good success with the following code (on Windows at least):

Head over and check out the full list of virtual key codes on Embarcadero’s webiste for use with Delphi XE6 Firemonkey.

Have Delphi Firemonkey questions? Ask and get answers on StackOverflow.

Leave a Reply

Show Buttons
Hide Buttons
Read previous post:
Access A MIDI Keyboard Using CoreMIDI With Delphi XE5 Firemonkey On IOS

Developer Pavel Jiri Strnad has a post up on his blog on how to access a MIDI keyboard using Delphi...