Page 1 of 1

CEF always focused

Posted: Wed Mar 11, 2020 8:13 pm
by petko
I have a really strange problem: sometimes when my app starts, the CEF window stays focused with a blinking caret (I show a text editor in the CEF window). No matter what other control is actually focused in the application, the CEF window caret is still blinking.

This happens rarely, but when it does, it is really confused for the end-user as some commands are shared between the CEF text editor and other controls in the application and the user is not sure where the command will be executed.

Do you know what could cause that and is there some remedy for it?

Re: CEF always focused

Posted: Thu Mar 12, 2020 11:46 am
by salvadordf
Hi,

I haven't seen those issues personally but some users ask about focus issues from time to time because CEF still has an unresolved focus issue.
http://magpcss.org/ceforum/viewtopic.php?f=6&t=12205
https://bitbucket.org/chromiumembedded/cef/issues/1856

Read this for some workarounds :
https://www.briskbard.com/forum/viewtop ... 723&p=3299

Re: CEF always focused

Posted: Mon Mar 16, 2020 5:25 pm
by petko
I think that it is a different problem: it happens at a random rate. Probably 1 of 20-50 app starts. Probably has something to do with threads, but I have no idea what..

So I was just asking if I am the only one getting this behavior..

Re: CEF always focused

Posted: Mon Mar 23, 2020 7:34 pm
by petko
Just to clarify: it seems that one some app starts the Chromium component is created, but somehow is excluded from the common VCL mechanism for automatic focus setting. If you click on the Chromium visually the previously focused control loses focus, but the ActiveControl of the form still has it set a the control in focus. If, however, you use SetFocus programatically on the Chromium component, it is properly set as ActiveControl for the form. But if you click on other control and then click back to the Chromium one, the bug persists..

Moreover, so far, it seems that I get this problem only for the first created Chromium after the app start. Subsequent Chromium controls that are created after user actions never have this focus problem..