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
#2
Hi jkirstaetter,

Good morning.
I’m seeing about 4 issues in that post… which muddles the water a bit.

For several of those we have issues logged already, but your main issue, for which you started the post - the focus issue - is new to me.
Can you create a small reproducible sample of this issue and send that by email?
That would help a lot in being able to reproduce it here and look into that.
 
Thanks!
--
Wil
Reply
#3
Hello Wil,Thanks for quick response and handling.

(2023-03-16, 09:54:58)wila Wrote: For several of those we have issues logged already, but your main issue, for which you started the post - the focus issue - is new to me.
Can you create a small reproducible sample of this issue and send that by email?
That would help a lot in being able to reproduce it here and look into that.

Sure, will do.
However, it might take a bit time to isolate everything as we have several levels of class inheritance in our project.

Meanwhile, I got some feedback from another VFP developer Christof W. (Foxpert) that this could be related to the "form/window" handle that an ActiveX control might create and hence disables other parts. This could be helping for the modal form (WindowType):

Code:
* HWND des ActiveX Controls aus dem Activate des Formulares heraus aufgerufen werden.
*========================================================================================
LParameter tnHWND

    Declare Long GetParent in Win32API Long
    Declare Long EnableWindow in Win32API Long, Long
    EnableWindow( GetParent(m.tnHWND), 1 )
Thanks in advance and best regards, Jochen

"The only frontiers are in your mind."
Reply
#4
Hi,

Say thanks to Mr. Foxpert from me. This is the type of thing we've been looking for.
It's not easy to find this type of low level knowledge about FoxPro these days.

I will give it a go and see if I can make it work for the AntView control.
--
Wil
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)