Popping up the Touch Keyboard in Windows

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Popping up the Touch Keyboard in Windows

Postby andpad » Fri Apr 13, 2018 5:25 pm

Hello,

I've embedded CEF into a Win32 C++ app which needs to function on touchscreen machines as well as non-touchscreen. I'm currently having issue where clicking on a text box (in a webpage) does not bring up the Windows touch keyboard. I've done some google searching to see how I can make this work, but so far I've been unsuccessful.

I found this related issue post for CefPython https://github.com/cztomczak/cefpython/issues/57 and tried a couple of things:

I've embedded the following switches in my OnBeforeCommandLineProcessing handler and OnBeforeChildProcessLaunch:
Code: Select all
 command_line->AppendSwitchWithValue(CefString("touch-events"), CefString("enabled"));
command_line->AppendSwitchWithValue(CefString("disable-usb-keyboard-detect"), CefString("1"));


I registered the browser as a touch window in my OnAfterCreated handler:
Code: Select all
RegisterTouchWindow(browser->GetHost()->GetWindowHandle(), NULL);


The second comment in the CefPython issue says
When clicking an edit field there is no virtual keyboard appearing, but this could be implemented on your own by injecting javascript on web pages through LoadHandler.OnLoadStart() or OnLoadEnd(), the
same can be done for other touch related behavior, when --touch-events=enabled flag is passed then javascript touch events will be enabled (touchstart, touchend, touchmove), allowing you to override the default behavior or implement the missing one.

However, I'm not a web developer, so I'm not sure how it would be possible to accomplish this by injecting javascript. I'm assuming they must be referring to some method of accessing some Windows API to bring up the keyboard, but I haven't found anything related to that in my searching.

Any help is appreciated.

Thank you.
andpad
Techie
 
Posts: 29
Joined: Mon Oct 23, 2017 1:57 pm

Re: Popping up the Touch Keyboard in Windows

Postby Czarek » Fri Apr 13, 2018 11:51 pm

The cefpython issue you reference is old. What OS? What CEF version? Are you using windowed rendering or off-screen rendering? Have you tested with cefclient sample application? Does touch keyboard appear in Google Chrome on that same machine?

Update:
Do you have a physical keyboard plugged in when testing? Try "--disable-usb-keyboard-detect" flag.
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: Popping up the Touch Keyboard in Windows

Postby andpad » Mon Apr 16, 2018 6:10 pm

Update:
Do you have a physical keyboard plugged in when testing? Try "--disable-usb-keyboard-detect" flag.


I was previously testing with a Wacom touch screen tablet (DTH-1152) connected to my laptop, and I couldn't get that working ( even with the "--disable-usb-keyboard-detect" enabled).

I just did a test on an HP All-In-One-PC (24-g237c) with the "--disable-usb-keyboard-detect" flag and with the keyboard disconnected and It worked.
The touch keyboard also comes up when the keyboard is connected and a touch is used to gain focus on a textbox.

I'll be testing with a Microsoft Surface Book tomorrow.

To get clarification, do touch events only get enabled if no keyboard is detected?

BTW, using Windows 10 and cef_binary_3.3163.1671.g700dc25_windows32.
andpad
Techie
 
Posts: 29
Joined: Mon Oct 23, 2017 1:57 pm

Re: Popping up the Touch Keyboard in Windows

Postby andpad » Tue Apr 17, 2018 6:31 pm

I tested by doing a finger touch on a textbox with a Microsoft Surface Book. I saw that the touch keyboard only comes up when the laptop is in tablet mode. This is also the case with cefclient. These tests were done with the "--touch-events=enabled" and "--disable-usb-keyboard-detect" flags.
Additionally, using the Surface Book's pen does not work at all, only a finger touch seems to bring up the touch keyboard.

This actually seems to function as expected with the latest Chrome (Chromium version 65.0.3325.181) in desktop mode with neither of these flags applied. So hopefully using a CEF build with Chromium ver 65.0.3325.181 or later should work. I'll be testing this tomorrow.
andpad
Techie
 
Posts: 29
Joined: Mon Oct 23, 2017 1:57 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 56 guests