Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BeforeNavigate2 in Web Browser control 1

Status
Not open for further replies.

Mike Lewis

Programmer
Jan 10, 2003
17,516
Scotland

I have a form with a Web Browser Control. The control contains code in its BeforeNavigate2 event.

Most of the time, everything works fine. But occasionally, the BeforeNavigate2 fails to fire. As far as I can see, this happens the first time that the browser tries to navigate to a URL since instantiating the form. After that first time, everything works as expected.

The behaviour is the same, regardless of whether I call Navigate2 explicitly, or the user clicks a hyperlink.

Any insights would be appreciated. The problem occurs both with VFP 8.0 and 9.0; I've only tested it with IE 6.0.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
I am not sure if this applies but in the past with Version 6 and some ocx/dll's I had to add
Application.AutoYield=.f. in my code to tell fox how to handle the objects events. The symptom in this case would be some events not firing.

Steve Bowman
Independent Technology, Inc.
CA, USA
 
I may have that backward the help file says
lExpr Description
True (.T.)
(Default) The instance of Visual FoxPro processes pending Windows events between execution of each line of user program code.

If lExpr is set to true (.T.), the instance of Visual FoxPro processes pending Windows events in the same manner as earlier versions of Visual FoxPro.

False (.F.)
The instance of Visual FoxPro does not process pending Windows events between each line of user program code.

All pending Windows events are placed in a queue, and the events in the queue are processed when DOEVENTS is issued or a wait state occurs. A wait state occurs when Visual FoxPro is waiting for input from the user. The WAIT command does not create a wait state.


Steve Bowman
Independent Technology, Inc.
CA, USA
 

Steve,

You might have hit it. I was under the impression that AutoYield was the same as SYS(2333), which I already have in the form. But reading those extracts from the Help file made me think again.

Anyway, I'll experiment with AutoYield when I'm at the client's site tomorrow, and report back.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
I wonder.... wasn't it setting _vfp.AutoYield = .T. that helps with OCXes? Well, it's two tests on that matter.

What you need for sure is a NODEFAULT in the Refresh() event of the webbrowser control. That's a known issue with that OCX.

By the way, if you take a look at the xsource (there was an update you can download from microsoft) you'll find the source code for the VFP9 taskpane. That should also answer additional questions you may have.

Bye, Olaf.
 

Olaf,

Thanks for that. I'll try Steve's suggestion first, then look at the task pane if necessary.

I know about NODEFAULT in the Refresh. I always put it there to prevent OLE error messages during instantiation.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 

Steve,

Your suggestion was spot on. I added _VFP.AutoYield = .F. to the form's Load, and the problem disappeared. I now have a happy client, which means I'm happy too.

Many thanks.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top