On-Screen Keyboard didn't show up when focus on input component

We use JUCE to develop GUI application that runs on Microsoft Surface Pro. The app has several input components that collect user input.

When physical keyboard not present and keyboard focus on input control, we expect On-Screen Keyboard to auto show up and allow user to type. This is the behavior for build-in app like Notepad or Explorer., but not the case for JUCE based application.

In order to bring up OSK, we need to press keyboard icon on taskbar icon.Is there extra step we should do to enable On-Screen Keyboard auto show up?

  • JUCE 4.3.0 (tried develop branch, same behavior)
  • Windows 10 Pro 64-bit 1607 on Microsoft Surface Pro 3
1 Like

Hi @fabian,

Sorry to bother you but we really need to know if this is known issue or we did anything wrong? (JuceDemo do have problem bring up On-Screen Keyboard when TextEditor is in focus)

Hi @sam,

TBH we have never tested the on-screen keyboard and JUCE on the surface pro. It’s something we’ll have to follow up on once we are all back in the office.

When JUCE expects text input, it will call the textInputRequired function here. We currently simply call the win32 ShowCaret method. Apparently, it’s not enough to invoke the on-screen keyboard.

Searching msdn/stackoverflow for a simple way to trigger the on-screen keyboard didn’t bring up any results. In fact, it seems as if this may not even be possible without a native text-input control.

Is there anyone out there with some more knowledge on this subject?

Haven’t solve this yet, just to provide some information.

I am trying to find clues from this Microsoft Input: Touch keyboard sample. It is a Windows Store app but seems like the interface it used to bring up touch keyboard are:

Above interfaces has COM equivalent, which seems to me can be used to develop custom control that is touch keyboard friendly. Seems like it has some UI Automation techniques involved. Keep digging…

https://code.msdn.microsoft.com/windowsapps/Touch-keyboard-sample-43532fda

Yes I saw this as well. This means we will need to overlay an invisible xaml widget over juce’s text inputs. This will probably mess up all sorts of things like mouse events etc. This could get quite messy… arrgghhh… why is this soo hard?

Found another information on StackOverflow: http://stackoverflow.com/questions/38774139/show-touch-keyboard-tabtip-exe-in-windows-10-anniversary-edition

It involves a undocumented COM interface to toggle visibility of Touch Keyboard. I’ve tried it and works. Below is what I done:

  1. Check if TabTip.exe under C:\Program Files\Common Files\microsoft shared\ink is running, if not, run it.
  2. If TabTip.exe is running, create a undocumented object of ITipInvocation and invoke the Toggle() function by passing desktop window handle as parameter.

With that, I can show/hide the Touch Keyboard quite nicely.

Next step is to integrate into JUCE Component. I am working on TextEditor first. The idea is to derive from TextEditor and override its focusGained/focusLost method, in that, show/hide Touch Keyboard with ITipInvocation interface.

1 Like

Looks like the approach of overriding focusGained/focusLost works (see attached screenshot), but wonder if there is a better way to do this. Replace all TextEditors with my customized one seems not a great solution.

I checked TextEditor::Listener, it does not know when TextEditor gain focus. For the project I am working on, I will stick with current implementation.

BTW, I tested the undocumented COM interface on Windows 8/8.1/10, all works.

Wow thanks for this reference!! This will be the way to go. We’ll add this to JUCE.

OK I’ve just added this to the develop branch of JUCE (should be public in a few minutes). I haven’t added automatically launching the TabTip.exe because I’d like to only launch this if the computer is in tablet mode (otherwise the on-screen keyboard would launch on everyone’s computers).

Can you check that my implementation works for you (by launching TabTip.exe manually for now)? Thanks!

Hi @fabian,

Verified the change you made and it works! With this, I don’t need to create custom control. Thank you!

I do find a behavior that looks not quite right. Say I have a dialog with one TextEditor (like the one in my previous reply), with below steps:

  1. Tab TextEditor, Touch Keyboard shows up.
  2. Tab close button on Touch Keyboard at top-right corner to dismiss it. (Dialog remains open)
  3. Tab close button on dialog, then Touch Keyboard shows up again but there is nothing to input.

Uh oh - I’m finding on my Surface Pro 3 that clicking in Text Editors always opens the on-screen keyboard - i.e. even when not in Tablet Mode. It’s absolutely maddening in ProJucer!

There is a setting that allows user to decide whether OSK should enabled when not in Tablet mode. It would be nice if JUCE could refer to that setting and decide whether to show OSK or not.

I’ve just pushed an update to develop. @sam can you check that the behaviour is now correct?
 
 

@sam @Andrew_J Can you send me a reference to this setting? How can I query it?

Hi Fabian, note that there are two different on-screen keyboards and it’s the Touch Keyboard that pops up any time a text editor gets or loses focus.

  • On Screen Keyboard (Windows Settings >> Ease of Access >> Keyboard)
  • Touch Keyboard (Windows Settings >> Devices >> Typing >> Touch Keyboard >> Show the touch keyboard when not in tablet mode and there’s no keyboard attached)

I haven’t looked into programattically querying these.

1 Like

@fabian,

Yes. The Touch Keyboard behavior works like expected. Thank you!

OK the on-screen keyboard should now only pop up if Windows is actually in tablet mode.

1 Like