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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PDF in web brower

Status
Not open for further replies.

AlastairP

Technical User
Feb 8, 2011
286
AU
I have a web control in a form and can view pdf files.
I have a grid which I scroll down and I can see the pdf's
BUT no matter what I try, the grid looses focus when displaying the pdf in the browser. I have to keep clicking with the mouse back on the grid to select the next item.
Have tried set focus
any ideas?
 
You might try some standards for ActiveX controls: _VFP.Autoyield = .F.

And especially for the webbrowser control, put NODEFAULT in it's Refresh() method.

In regard to further discussion. Do I get you right with the following interpretation:

What do you mean with "a grid which I scroll down and I can see the pdf's". The webbrowser control is in the grid?

Or is it this way?
Does the grid show file names and once you chosse a grid row the pdf is displayed in a webbrowser control on the form, but outside the grid?

I don't know the details going on, but I do know in genral every ActiveX Control is just an embedded Form, you have a form inside a form therefore you can eaasily have focus problems, because most probably the foxpro form lost focus to the ActiveX control (form).

If you setfocus() to some control of an inactive form, it normally will get the active form again, but ActiveX controls can be somewhat problematic hndering the focus to go back to the foxpor parent form.

If all else fails you should declare SetActiveWindow and set the vfp form active additionally to setting grid.setfocus(). You might also call Refresh() of the grid to make it display it's focus.

Bye, Olaf.
 
Hi Olaf,

"Does the grid show file names and once you chosse a grid row the pdf is displayed in a webbrowser control on the form, but outside the grid?"
= YES, exactly that

I will experiment with your suggestions and report back for reference,
Thanks Olaf
 
To follow up,
I am not sure if I made any mistakes, but I could not get any of the suggestions to work.
However, I did find a work around which I shall use until I can get it to work another way:
After the method to load the PDF into the browser,I added a messagebox, this returns focus to the form:


Its a bit rough, but it will do for now
Code:
Thisform.ShowPdf()
MESSAGEBOX("Loading file ... please wait",0,1)
thisform.list1.SetFocus
this.Refresh()

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top