Page 1 of 1

CefParentWindow, Touch, and Focus

Posted: Wed Jun 17, 2020 11:38 pm
by rgdawson
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
    begin
      CEFWindowParent1.SetFocus;
    end);
My question is, should the CefParentWindow get focus when "touched" on a touch capable device?

R Greg Dawson

Re: CefParentWindow, Touch, and Focus

Posted: Thu Jun 18, 2020 7:26 am
by salvadordf
Hi,

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".