OnSetFocus not working

Post Reply
thefunkyjoint
Posts: 330
Joined: Thu Aug 10, 2017 12:40 pm

OnSetFocus not working

Post by thefunkyjoint »

Hi,

I use the onSetFocus method setting result := true when i want to avoid the browser to steal focus. It always worked well but looks like the last update broke this functionality ; the browser is stealing focus anyway.

Can anyone confirm this please ?

Thanks
User avatar
salvadordf
Posts: 3067
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: OnSetFocus not working

Post by salvadordf »

Hi,

I just did some tests with the TabbedBrowser2 demo.

I added a small TEdit in the left panel and I used the OnKeyUp to create a new tab when I press the "a" key.

The unmodified TabbedBrowser2 demo set the focus on the new browser tab but then I did a couple of modifications :
  • Use the TChromium.OnSetFocus event and set Result to true
  • Set TChromium.DefaultWindowInfoExStyle to WS_EX_NOACTIVATE before the TChromium.CreateBrowser call.
With those modifications the TEdit kept the focus when I pressed "a" even after creating the new browser tab.
Student
Posts: 55
Joined: Tue Aug 07, 2018 9:20 am

Re: OnSetFocus not working

Post by Student »

To prevent the browser from stealing focus, I usually set the enabled = false property of TchromiumWindow, when I know for sure that this browser is not used, and when the tab is activated, then enabled = true
thefunkyjoint
Posts: 330
Joined: Thu Aug 10, 2017 12:40 pm

Re: OnSetFocus not working

Post by thefunkyjoint »

I'll do some tests with these suggestions.

What i noticed is, when my application is idle but with some web page open (Instagram for instance), randomly the app will popup in front of other windows, probably because a new notification has arrived on Instagram, for instance. This behaviour did not happen prior to recent updates.
Post Reply