xsharp.eu • FoxPro Webbrowser
Page 1 of 1

FoxPro Webbrowser

Posted: Sun Sep 22, 2019 5:04 pm
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 :)

FoxPro Webbrowser

Posted: Mon Sep 23, 2019 6:03 am
by lumberjack
Good day Paula,

Are you using VFP or X# with VFP syntax to do this?

FoxPro Webbrowser

Posted: Mon Sep 23, 2019 9:20 am
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()

FoxPro Webbrowser - Matt??

Posted: Mon Sep 23, 2019 9:47 am
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!

FoxPro Webbrowser - Matt??

Posted: Mon Sep 23, 2019 10:41 am
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.

FoxPro Webbrowser

Posted: Mon Sep 23, 2019 5:34 pm
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.

FoxPro Webbrowser

Posted: Fri Sep 27, 2019 8:39 pm
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