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
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)
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…
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?
It involves a undocumented COM interface to toggle visibility of Touch Keyboard. I’ve tried it and works. Below is what I done:
Check if TabTip.exe under C:\Program Files\Common Files\microsoft shared\ink is running, if not, run it.
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.
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.
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!
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.
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.