Antwise community forums
[VFP] Modal Window not displaying - Printable Version

+- Antwise community forums (https://forums.antwise.com)
+-- Forum: Antview (https://forums.antwise.com/forumdisplay.php?fid=11)
+--- Forum: Antview for Windows (https://forums.antwise.com/forumdisplay.php?fid=12)
+--- Thread: [VFP] Modal Window not displaying (/showthread.php?tid=136)



[VFP] Modal Window not displaying - echolis - 2022-10-12

This is the first I've come across this problem, which seems to be specific to this ActiveX control.

VFP has the ability to display forms within a Top-Level form as a Modal. With a Modal Window no user input (keyboard or mouse) can occur in any other form or in the menu until the modal form is hidden or released. Showing it "In a Top-Level Form" means the form is a child form of the active top-level form, which can be the main Visual FoxPro window or another top-level form.

I'm using the provided VFP form as a sample, which works great.

Basically, I'd like the form with the AntView control to be confined within my main application's window and be the only window that can receive events or be interacted with. If I use the normal settings (In Top-Level Form and Modal), the form never appears. It's init methods run, as well as it's destroy and release methods.

The form appears as normal when setting it to be Modeless.

It's almost as if the ActiveX control is preventing the window from displaying.


RE: [VFP] Modal Window not displaying - wila - 2022-10-13

Hi,

Thanks for the report.
This is when setting a property on the form that hosts the AntView control if I'm not mistaken. In particular when the form property Windowstype is set to Modal instead of Modeless, right?

If so I have a bug report open on this and it seems like that that one slipped through the cracks. I need to install VFP9 on my development machine to run this through a debugger and see if I can figure out what is happening.

--
Wil


RE: [VFP] Modal Window not displaying - echolis - 2022-10-13

(2022-10-13, 12:43:49)wila Wrote: Hi,

Thanks for the report.
This is when setting a property on the form that hosts the AntView control if I'm not mistaken. In particular when the form property Windowstype is set to Modal instead of Modeless, right?

If so I have a bug report open on this and it seems like that that one slipped through the cracks. I need to install VFP9 on my development machine to run this through a debugger and see if I can figure out what is happening.

--
Wil

Exactly Wil, the Form.WindowType is set to 1 (Modal). In my instance, Form.ShowWindow is also set to 1 (In Top-Level Form). In my form Init, I'm immediately navigating to a URL; which I can confirm (with Fiddler) does successfully execute.


RE: [VFP] Modal Window not displaying - wila - 2022-10-17

(2022-10-13, 14:13:42)echolis Wrote: Exactly Wil, the Form.WindowType is set to 1 (Modal). In my instance, Form.ShowWindow is also set to 1 (In Top-Level Form). In my form Init, I'm immediately navigating to a URL; which I can confirm (with Fiddler) does successfully execute.

Hi,

Running this in a debugger didn't really help much, beyond that it all seems to run normal from the point of view of AntView.
My suspicion is that the creation of the out-of-process WebView2 control is playing havoc with the form initialization of the modal Fox Pro form.

One thing I tried was to see if I could change the form modality once the webview2 control is created by setting Form.WindowType to 1 from the OnCreateWebViewCompleted event.
eg.
Code:
thisform.WindowType = 1

But that triggers a readonly error.
My guess is that VFP does not allow you to change that after the form has been created (which is not uncommon for Windows)

Next thing I did - and that appears to work - is to set Form.ShowWindow to 2.
In that case the Form is created.

As you mentioned having ShowWindow set to 1, you might already know that, so I'm not sure how useful that is.

If the above doesn't help then I think I would try to create the AntView control dynamically.
Sadly that is currently a bit out of my league in as far as my current FoxPro knowledge goes. I will have a go at that, but figured to at least give you my current feed back on this issue.
--
Wil


RE: [VFP] Modal Window not displaying - wila - 2022-10-17

I might have a workaround.

Got the idea from here:
https://www.tek-tips.com/viewthread.cfm?qid=77132

The idea to change the modal state of the form from the OnCreateWebViewCompleted seems that it is possible if you temporarily set the form's visibility to false for a moment.

eg.

Code:
*** ActiveX Control Event ***
LPARAMETERS hresult

thisform.Visible = .F.
thisform.WindowType = 1
thisform.Visible = .T.

That actually runs for me and the form is displayed as expected.

The other interesting part from the link above is that there are other controls that have this issue. Would be nice to know if there's a way for me to handle this in the control, but so far I haven't found what I should do for addressing that.
--
Wil


RE: [VFP] Modal Window not displaying - echolis - 2022-10-31

(2022-10-17, 12:46:28)wila Wrote: I might have a workaround.

Got the idea from here:
https://www.tek-tips.com/viewthread.cfm?qid=77132

The idea to change the modal state of the form from the OnCreateWebViewCompleted seems that it is possible if you temporarily set the form's visibility to false for a moment.

eg.

Code:
*** ActiveX Control Event ***
LPARAMETERS hresult

thisform.Visible = .F.
thisform.WindowType = 1
thisform.Visible = .T.

That actually runs for me and the form is displayed as expected.

The other interesting part from the link above is that there are other controls that have this issue. Would be nice to know if there's a way for me to handle this in the control, but so far I haven't found what I should do for addressing that.
--
Wil

This works great to get the form to display. But, the control itself doesn't actually display; I can see that the navigate fires and is successful. The control is just in it's default "grey" state.

I was able to fix that by setting the control to visible = .f. and then .t., see below:

Code:
*** ActiveX Control Event ***
LPARAMETERS hresult

this.Visible = .f.
thisform.Visible = .F.
thisform.WindowType = 1
thisform.Visible = .T.
this.Visible = .t.



RE: [VFP] Modal Window not displaying - wila - 2022-10-31

(2022-10-31, 16:25:07)echolis Wrote: This works great to get the form to display. But, the control itself doesn't actually display; I can see that the navigate fires and is successful. The control is just in it's default "grey" state.

I was able to fix that by setting the control to visible = .f. and then .t., see below:

Code:
*** ActiveX Control Event ***
LPARAMETERS hresult

this.Visible = .f.
thisform.Visible = .F.
thisform.WindowType = 1
thisform.Visible = .T.
this.Visible = .t.

Glad to hear you got a functioning workaround.

I'd much rather fix it in the control though.
Sadly don't know what to do in order to make it behave like VFP expects.
There's not a lot of low level info out on VFP anymore (or at least I don't know where to find it).
Good tips on books etc.. are welcome.
--
Wil


RE: [VFP] Modal Window not displaying - Patrickb - 2022-11-03

I had the same issue.
This is my work around in the forms activate event
IF THISFORM.flactivate && initially true

     THISFORM.flactivate = .F.

     THISFORM.timer1.INTERVAL = 500

     THISFORM.VISIBLE = .T.

     THISFORM.oBrowser.Navigate(THISFORM.fcLink)

ENDIF


RE: [VFP] Modal Window not displaying - jkirstaetter - 2023-03-31

(2022-10-12, 22:35:42)echolis Wrote: This is the first I've come across this problem, which seems to be specific to this ActiveX control.
...
It's almost as if the ActiveX control is preventing the window from displaying.

Try to fix the ActiveX. Big Grin 

Code:
*========================================================================================
* HWND des ActiveX Controls aus dem Activate des Formulares heraus aufgerufen werden.
*========================================================================================
Function ActiveFix
LParameters tnHWND
    Declare Long GetParent in Win32API Long
    Declare Long EnableWindow in WIn32API Long, long
    EnableWindow( GetParent(m.tnHWND), 1 )
EndFunc

Code is courtesy of Christof W. (Foxpert)


RE: [VFP] Modal Window not displaying - wila - 2023-03-31

This is something I am going to look into as it is best fixed in the ActiveX control itself.
Sorry have been a tad busy, so it is still on the list, but should be able to get to it pretty soon.
--
Wil


RE: [VFP] Modal Window not displaying - wila - 2023-04-18

Hi,

FYI, I have tried the proposed fix and it did not work for me when trying to patch it in the ActiveX.

Does it work in when using the above in VFP? If so can you get me a code example where it works?
There might be some timing issue or something else very specific that makes it work for you, but not for me.

--
Wil