How to leave the Android virtual keyboard visible / invisible while TEdit is in focus

2

I use Delphi XE7 , I wanted to know how to handle this question, if I focus on TEdit , it opens the virtual keyboard of Android , I press it back it closes the keyboard and the focus remains on TEdit but when I press again on TEdit while the same is in focus it does not open the virtual keyboard anymore.

Does anyone have any idea how to solve it?

    
asked by anonymous 05.12.2016 / 12:49

3 answers

3

I have no way to test it now, but try the following code in% Edit:%

procedure TForm1.Edit1Enter(Sender: TObject);
var
  VKbSvc: IFMXVirtualKeyboardService;
begin    
  if TPlatformServices.Current.SupportsPlatformService(IFMXVirtualKeyboardService, VKbSvc) then
  begin
      VKbSvc.ShowVirtualKeyboard(Edit1);
  end;
end;
    
05.12.2016 / 13:05
3

Try to use the global variable VKAutoShowMode := TVKAutoShowMode.vkasAlways , so that the keyboard always appears. Also do not forget to include the unit FMX.Types in the project, as this is where this global variable resides.

    
05.12.2016 / 13:36
1

I can not test now, but try the following code in the OnEnter's Edit:

procedure TForm1.Edit1Enter(Sender: TObject); var   VKbSvc: IFMXVirtualKeyboardService; begin       if TPlatformServices.Current.SupportsPlatformService(IFMXVirtualKeyboardService, VKbSvc) then   begin
      VKbSvc.ShowVirtualKeyboard(Edit1);   end; end;

Complementing the colleague's solution, to use this it is necessary to put FMX.VirtualKeyboard and FMX.Platform in imports.

    
23.05.2018 / 14:02