CefParentWindow, Touch, and Focus

Post Reply
Posts: 14
Joined: Tue Apr 10, 2018 11:05 pm

CefParentWindow, Touch, and Focus

Post by rgdawson » Wed Jun 17, 2020 11:38 pm

I recently discovered this so I thought I would share. In my app, I am using a CefParentWindow that is sometimes hidden (Visible = False). When I set visible to True, of course, the CefParentWindow does not have focus. Clicking on the CefParentWindow, of course, gives it focus. What I discovered is that using touch does not give the CefParentWindow focus. So in my case, on a touch capable device, after making the CefParentWindow visible, if the user used touch to select a field in the browser and started typing, all the keyboard input went elsewhere, not the browser, so the user could not enter data until he used the actual mouse to click on the browser.

In my case I could solve my problem by:

Code: Select all

    CEFWindowParent1.Visible := True;
    TThread.ForceQueue(nil, procedure
My question is, should the CefParentWindow get focus when "touched" on a touch capable device?

R Greg Dawson

User avatar
Posts: 2412
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain

Re: CefParentWindow, Touch, and Focus

Post by salvadordf » Thu Jun 18, 2020 7:26 am


As far as I know, browsers using the normal mode (not the off-screen mode) should handle touch events automatically.

I don't have a touch screen and I had to install the "Microsoft Emulator" in Visual Studio to have an incomplete simulation of a touch screen. I could add touch support to the OSR demos with that emulator but I didn't test the other demos in normal mode.

Feel free to make code suggestions or create a pull request at Github if you find that the demos should add a call to "SetFocus".

Post Reply