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


#1

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

Some observations from using Juce on touch screens
#2

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)


#3

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?


#4

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


#5

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?


#6

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.


#7

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.


#8

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


#9

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!


#10

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.

#11

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!


#12

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.


#13

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?


#14

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.


Projucer 4.3.1 problem with on-screen keyboard
#15

@fabian,

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


#16

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