I have found many references to this problem, but I have not yet found a solution.
I use the following code to hide the virtual keyboard, but it does not work.
FService: IFMXVirtualKeyboardService;
...
procedure TForm1.FormCreate(Sender: TObject);
begin
TPlatformServices.Current.SupportsPlatformService(IFMXVirtualKeyboardService, IInterface(FService));
if FService = nil then ShowMessage('xxxxx');
end;
.....
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; var KeyChar: Char; Shift: TShiftState);
begin
//ShowMessage(IntToStr(Key) + '~' + KeyChar + '~');
//Application.ProcessMessages;
if (Key = vkHardwareBack) then
begin
// this code is executed
Application.Terminate;
Key := 0;
end
else
if Key in [vkRETURN, vkACCEPT] then begin
// this code never executed
if (FService <> nil) then begin // FService isn't nil
FService.HideVirtualKeyboard;
end;
end;
end;
When "Accept" or "Enter" is pressed, the value of Key
is always zero, so the keyboard code is not executed. Why?