FoxPro Webbrowser

This forum is meant for questions about the Visual FoxPro Language support in X#.

Post Reply
Anonymous

FoxPro Webbrowser

Post by Anonymous »

Hi!

I have a form with a grid and a object webbrowser.
The form show in the grid a list of documents, and the webbrowser make a preview of the PDF.
The problem it's when the user click on the PDF, I lost focus on my grid, even when i click on a row on the grid the focus don't work. Sometimes i have problems with the typing on keyboard after the click on the PDF.
So i have tried create a Shapebox, in front of the webbrowser , for the user don't click on the PDF, but the webbrowser appears always on the front of the shape, even when i force the Zorder.

I have the NODEFAULT in the refresh of the webbrowser.
It's any way or a trick for this?

Thank you a lot for the help :)
User avatar
lumberjack
Posts: 729
Joined: Fri Sep 25, 2015 3:11 pm
Location: South Africa

FoxPro Webbrowser

Post by lumberjack »

Good day Paula,

Are you using VFP or X# with VFP syntax to do this?
______________________
Johan Nel
Boshof, South Africa
Paula Cordeiro

FoxPro Webbrowser

Post by Paula Cordeiro »

Hi !

I'm using VFP.
I do something like that

Code: Select all

 this.pageframe1.page1.logrechtml.Navigate(uFile)
 this.pageframe1.page1.Sigdatagrid1.SetFocus()
User avatar
lumberjack
Posts: 729
Joined: Fri Sep 25, 2015 3:11 pm
Location: South Africa

FoxPro Webbrowser - Matt??

Post by lumberjack »

Matt, can you assist?
Paula Cordeiro wrote:Hi !
I'm using VFP.
I do something like that

Code: Select all

 this.pageframe1.page1.logrechtml.Navigate(uFile)
 this.pageframe1.page1.Sigdatagrid1.SetFocus()
Hi Paula, please bear with us. VFP is a new syntax to us X# guys, so not always immediately clear what a solution would be. I am sure Matt Slay will come to the rescue...

But in the meantime welcome to the X# website!
______________________
Johan Nel
Boshof, South Africa
alanbourke

FoxPro Webbrowser - Matt??

Post by alanbourke »

If you're doing this with actual Visual FoxPro you might have more luck posting it on StackOverflow, or Foxite or similar. I suspect it is something weird to do with the webbrowser control as opposed to VFP syntax.
FoxProMatt

FoxPro Webbrowser

Post by FoxProMatt »

I do not think we should use this message board to discuss or support purely VFP issues. This forum is for discussing VFP issues related to X#.

There are plenty of places to seek VFP help:
Foxite, MSDN FoxPro forum, Level Extreme, Profox message board, Stack Overflow.
George
Posts: 106
Joined: Thu Nov 05, 2015 9:17 am

FoxPro Webbrowser

Post by George »

Hi paula,

I also had problem showing .pdf files in WebBrowser (in X#).
The solution I found is to 'steal' the focus in DocumentCompleted Event.
I do not know if it helps in your case but it seems similar.

Here is my solution in a X# code sample:

PUBLIC TimerStealFocus AS System.Windows.Forms.Timer

SELF:TimerStealFocus := System.Windows.Forms.Timer{SELF:components}

//
// TimerStealFocus
//
SELF:TimerStealFocus:Interval := 500
SELF:TimerStealFocus:Tick += System.EventHandler{ SELF, @TimerStealFocus_Tick() }

PRIVATE METHOD WebBrowser_DocumentCompleted( sender AS System.Object, e AS System.Windows.Forms.WebBrowserDocumentCompletedEventArgs ) AS System.Void
// WebBrowser Event sequence: FileDownload, Navigated, DocumentCompleted
IF e:Url:ToString():ToUpper():EndsWith(".PDF")
SELF:TimerStealFocus:Interval := 500 // 0.5 sec
SELF:TimerStealFocus:Start()
ENDIF
RETURN

PRIVATE METHOD TimerStealFocus_Tick( sender AS System.Object, e AS System.EventArgs ) AS System.Void
SELF:TimerStealFocus:Stop()
IF ! SELF:myGrid:Focused
SELF:myGrid:Focus()
ENDIF
RETURN

regards
George
Post Reply