Jump to content
Sign in to follow this  
Sherlock

10.3.2 - FMX on Windows 10 Tablets with virtual keyboard

Recommended Posts

So I have this application, that runs smoothly on a standard PC, and does quite well on a tablet too. With one exception, the virtual keyboard causes quite the headache. Not only does Windows seem to have two different virtual keyboards, they behave quite differently too:

First there is the keyboard that has to be actively opened by the user by clicking on the symbol in the tray area. This works fine, but has the disadvantage of "an additional click". (Image 1)

Then there is a keyboard (image 2) that can be opened automatically when

FMX.Types.VKAutoShowMode := TVKAutoShowMode.Always;

is set. According to the fine manual this will cause the virtual keyboard to show even if there is a physical keyboard present. So as soon as the focus is set on an editable component like TEdit, this keyboard will popup and as soon as said component looses focus the keyboard will disappear. Now here's the tricky part: This keyboard looks different, and on some machines (HP tablets with an i5) takes ages (at least 30 seconds) to "pop up".  On my VM that I'm running on a Mac with an i7, this happens instantly.

 

Any user who knows iOS will consider option 1 to be "out of the question" so I use option 2, but for the life of me am not able to speed up the virtual keyboard popup process. This might just become a deal breaker, hence this post.

 

TL;DR: Does anyone here have experience with virtual keyboards on Windows tablets, and knows how to open them up quickly on slower systems?

 

Thanks,

Sherlock

Bildschirmfoto 2019-12-06 um 14.44.53.png

Bildschirmfoto 2019-12-06 um 14.45.55.png

Share this post


Link to post

The second one ("OSK") is a legacy keyboard while the first one ("tabtip") is the one that should be used, in my opinion.

 

Normally, Windows will invoke the keyboard when clicking/tapping text boxes with a finger (or pen, when configured). With FMX, it's still painted internally and not a "true" windows edit field with a HWND, right? I see FMX does its own thing in TVirtualKeyboardWin.Create (FMX.Platform.Win.pas), so you can probably use the global variable "VirtualKeyboardWin" and stuff in an implemtation that does not use the hardcoded path to "osk.exe".

  • Thanks 1

Share this post


Link to post

The sourcecode from FMX.Platform.Win.pas (at least in 10.0 Seattle) does it all by itself and just launches "osk.exe" which is the keyboard from your second picture.

 

The first one ("tabtip.exe") can (and as I believe, should) be launched instead.

Here is an example:

https://www.delphipraxis.net/186239-win-8-bzw-10-touch-tastatur-aufrufen.html#post1312405

 

Here is another but (not Delphi): https://github.com/AlexeiScherbakov/osklib

 

I see that TVirtualKeyboardWin.Create() in Fmx.Platform.Win.Pas may use hardcoded paths to "osk.exe", but there is also a global variable "VirtualKeyboardWin". I think you should be able to subclass TVirtualKeyboardWin to use "tabtip" instead. And thenm let the global variable point to an instance of your subclass.

 

  • Thanks 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×