Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WebBrowser control reactivates form
Message
From
20/07/2011 17:50:01
 
 
To
20/07/2011 17:22:16
Joel Leach
Memorial Business Systems, Inc.
Tennessee, United States
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Miscellaneous
Thread ID:
01518702
Message ID:
01518706
Views:
67
This seems like the best workaround. The web browser control focus issues have always bugged me, and I even tried to get the IE team to change or allow customization of the behavior as a hosted ActiveX control, but it's been like this for years (since IE4 I think). Glad you're having fun with my code in _webbrowser4, and my undocumented VFPS (VFP Script) method. :)

>I found a work-around... make the browser control invisible while launching the VFP form:
>
>*** BeforeNavigate2 ActiveX Control Event ***
>LPARAMETERS pdisp, url, flags, targetframename, postdata, headers, cancel
>
>If url = "vfps://myform"
>	Cancel = .t.
>	Thisform.LockScreen = .t.
>	This.Visible = .f.
>	Do form MyForm
>	This.Visible = .t.
>	Thisform.LockScreen = .f.
>EndIf
>
>Return DoDefault(pdisp, url, flags, targetframename, postdata, headers, cancel)
>
>
>
>>I'm using the IE WebBrowser control via the _webbrowser4 class in the FFC. I am using a vfps:// script to open a modeless VFP form, which works well, except the form hosting the browser control reactivates itself afterwards. I want the form I just launched to have focus, not the browser control. I have traced the code in the _webbrowser4 class, but I don't see any explicit Activate statement. Any idea what's going on and how to fix it?
>>
>>UPDATE: I tested on a base VFP form using the stock web browser control (no wrapper), and I get the same behavior. Here's the code I have in BeforeNavigate2():
>>
>>*** ActiveX Control Event ***
>>LPARAMETERS pdisp, url, flags, targetframename, postdata, headers, cancel
>>
>>If url = "vfps"
>>	Cancel = .t.
>>	Do form MyForm
>>EndIf
>>
>>Return DoDefault(pdisp, url, flags, targetframename, postdata, headers, cancel)
>>
>>
>>Thanks.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform