Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[VFP] Visibility out of sync and app/window focus moved away
#1
Bug 
Hi Wil,

Thanks for the great work you're doing.
It was straight forward to get started with Antview and replace the existing WebBrowser control.

I'm using Antview in a relatively large code base and I'm struggling with a few things. Hoping to receive some ideas or direction pointers to resolve those.
For context and given past experience I'm placing any ActiveX control into a VFP container control and then use that own container class anywhere else as needed. This keeps everything neat and located in one place regarding the automation or programming against the Antview control. FYI, works perfectly since 20+ years that way.

Now, as mentioned there are a couple of issues that most probably only occur when working with multiple instances.

Taking the thread [VFP] WebView2 Container always on top / not contained within Page Frame into consideration I've already moved on to explicit handling of a control's Visible attribute. However it's still a bit of weird situation during design time in the VFP IDE to have the ActiveX always on top overlapping anything else. Hopefully, you can make some progress here. Anyway, so irrespective that the mentioned event OnCreateWebViewCompleted won't fire I'm setting the initial value to .F. (false) and then it to .T. whenever I have to display the control, ie. Pageframe.PageX.Activate method. In general, it works as implemented although the Antview control should consider the Visible state of the surrounding container control itself, as you already mentioned. It's a workaround for the moment. Also referring to this thread [VFP] Modal Window not displaying by echolis.

Now, with this being said I also noticed that while enabling visibility of an Antview control, ie. using code like this in a Pageframe control on a Form.
Code:
*====================================================================
* Event handler: OnPageActivate which is bound using BindEvent(This.Pageframe.PageX, "Activate", This, "OnPageActivate")
*====================================================================

LOCAL loPage AS PAGE
loPage = .NULL.

THIS.SETALL("Visible", .F., "cntBrowserEdge")

loPage = THIS.PAGEFRAME.PAGES(THIS.PAGEFRAME.ACTIVEPAGE)
loPage.SETALL("Visible", .T., "cntBrowserEdge")

This switches off any Antview control anywhere on the entire Pageframe and then (re-)shows any Antview on the current Page.

I'm setting the Visible property on my Container class which usually has an Assign method to take care of the special needs of an ActiveX control, like this
Code:
*====================================================================
* ActiveX-Handling...
*====================================================================
LPARAMETERS tlVisible

OutputDebugString("UI.Browser.Edge.Visible: " + TRANSFORM(m.tlVisible) + ;
    " - " + TRANSFORM(SYS(1272, THIS)))

THIS.BROWSER.OBJECT.VISIBLE = m.tlVisible
THIS.BROWSER.VISIBLE = m.tlVisible
THIS.VISIBLE = m.tlVisible

Now, what I've noticed and is seen during execution is that when I switch to a Page with at least one Antview (container) control is that the whole application looses it's focus. Given the information read and gathered here in the forum I assume that either Antview's control or the WebView2 runtime orchestrates the out-of-process instance of Microsoft Edge browser and hence leaves the focus on that application instead of the VFP application using the control.
Perhaps Wil, if you could comment on that? Thanks.

In consequence my form doesn't have mouse focus anymore and hence I cannot focus any other native control, ie. a textbox, for further user interaction.

Shifting the (mouse) focus back to the VFP app triggers the Activate event again, you see where this leads to...

Now, one might argue to avoid using Activate event.
Fair enough, but what would be an alternative to handle the Visible property and the display of multiple instances of Antview on the same form?

Or am I barking up the wrong tree the way I implemented it currently?
Thanks in advance and best regards, Jochen

"The only frontiers are in your mind."
Reply


Messages In This Thread
[VFP] Visibility out of sync and app/window focus moved away - by jkirstaetter - 2023-03-16, 06:21:51

Forum Jump:


Users browsing this thread: 1 Guest(s)