Detect special keys from physical keyboard on iOS

Viewed 74

I'm trying to detect special keys in my Delphi iOS app using an external keyboard, a Smart Keyboard for iPad in my case. Every key that is also present in the OS virtual keyboard works perfectly.. but everything else doesn't.

My goal is to detect when the user press "special" keys, like:

  • Shift
  • Control
  • Option (alt)
  • Command
  • Arrow keys
  • Tab

I made a simple test app using this method for open the keyboard on a generic TFMXObject

uses
  FMX.VirtualKeyboard,
  FMX.Platform;

procedure ShowKey(AControl: TFMXObject);
var
  LKeyboardService: IFMXVirtualKeyboardService;
begin
  LKeyboardService := nil;
  if TPlatformServices.Current.SupportsPlatformService(IFMXVirtualKeyboardService, LKeyboardService) then
  begin
    LKeyboardService.ShowVirtualKeyboard(AControl);
  end;
end;

I tried to catch the KeyDown and KeyUp event on the form, on the TFMXObject called by that function, on a generic TEdit, but the event is never called for those special keys (except for arrow up and arrow down when a TEdit is selected)

I already read the documentation about the KeyDown event, but the event is not called at all for those keys

What can i do to detect KeyDown and KeyUp event for every possible key? Thank you!

0 Answers
Related