简体   繁体   中英

Delphi XE6 Firemonkey Mobile - How to disable Virtual Keyboard?

When I focus an edit-field on Android the virtual keyboard always popup. I like to disable this, or better to enable/disable this with the click of a button.

Currently I "solved" this with an timer that always closes the virtual keyboard after appearing. This is my code:

uses FMX.VirtualKeyboard;

procedure TForm1.Timer1Timer(Sender: TObject);
var Keyboard: IFMXVirtualKeyboardService;
begin
    if TPlatformServices.Current.SupportsPlatformService(IFMXVirtualKeyboardService,Keyboard) then
    begin
        if TVirtualKeyBoardState.Visible in Keyboard.GetVirtualKeyBoardState then
        begin
            Keyboard.HideVirtualKeyboard;
        end
    end;
end;

I hope youi can help me.

Thanks a lot!

You can disable automatic display of the virtual keyboard with

VKAutoShowMode := TVKAutoShowMode.Never;

It is defined in FMX.Types.

Put that in your DPR and then it will no longer automatically popup.

You can also place:

VKAutoShowMode := TVKAutoShowMode.Never;

in FormCreate event of main form.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM