Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

CEF always focused

Post Reply
petko
Posts: 52
Joined: Sun Jul 02, 2017 9:58 am

CEF always focused

Post 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?
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: CEF always focused

Post 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
petko
Posts: 52
Joined: Sun Jul 02, 2017 9:58 am

Re: CEF always focused

Post 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..
petko
Posts: 52
Joined: Sun Jul 02, 2017 9:58 am

Re: CEF always focused

Post 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..
Post Reply