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.

How to prevent delphi WVBrowser from stealing focus

Post Reply
SpringerRider
Posts: 8
Joined: Tue Sep 13, 2022 7:26 pm

How to prevent delphi WVBrowser from stealing focus

Post by SpringerRider »

I have just completed converting an app from TWebBrowser to TwvBrowser.
It works like a charm. Thank you very much for this.

With TWebBrowser, I had the "lost focus' issue that I could never resolve. Stack Overflow has many posts pertaining to this issue but no resolution.

I had hoped that TwvBrowser would have resolved this.
QtrMinutes.jpg
To repeat, load a page. On the right side upper grid, I have a pop up menu. When I open it and select an option, then go back in the browser, the I cannot place focus on the grid.
The work-around is to click on the lower grid to get focus back.

I had hoped that the TWVWindowParent might have some way corrected this. Any ideas?
You do not have the required permissions to view the files attached to this post.
User avatar
salvadordf
Posts: 4125
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to prevent delphi WVBrowser from stealing focus

Post by salvadordf »

Hi,

TWVWindowParent overrides the SetFocus procedure to focus the browser automatically. Perhaps this is the cause of this issue.

Check if TWVWindowParent is the first control to get the focus in the form. Perhaps you can fix this by changing the TWVWindowParent.TabStop property and setting TabStop := 0 in a different control.

Try setting the grid as focused automatically after executing each menu option.

There are several TWVBrowser functions and events related to the browser focus that might be useful too.
Post Reply