How is it possible to parse the URL of the desired popup to the popup-form AND show hints/tooltips in the WebKit-Component?

StackOverflow https://stackoverflow.com/questions/10110723

Pergunta

I'm trying to use the WebKit-component (http://www.webkit.org/) in VB with the help of Visual Studio 2008.

This is running without problems, except for two following two issues: 1. Hints/Tooltips are not shown (e.g. as there usually will appear one if you stay with the mouse over the Google-logo) 2. If there's a popup-window, I don't know how to get the new desired URL.

I'm already working a few days on this matter and couldn't find any solution yet :(

Maybe you know a solution to this problem.

Cheers Markus G.

P.S.: If you need more than the following Source Code to analyze the problem, then let me know ...

Source Code Form1

Imports System.IO
Imports WebKit

Public Class frmMain

  Private _url As String
  Private _mode As String
  Private _popupUrl As String


  Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    On Error Resume Next
    Dim bLogging As Boolean

    setWindowAndBrowserSettings()

    _url = "http://www.google.com"
    browserComp.Navigate(_url)
  End Sub

  Private Sub setWindowAndBrowserSettings()
    Me.Text = "Test - Browser"
    Me.WindowState = FormWindowState.Maximized
    browserComp.Dock = DockStyle.Fill
    browserComp.Visible = True
  End Sub

  Private Sub browserComp_NewWindowCreated(ByVal sender As Object, ByVal e As WebKit.NewWindowCreatedEventArgs) Handles browserComp.NewWindowCreated
    'frmPopup.WindowState = FormWindowState.Maximized
    frmPopup.Text = "ixserv - POPUP"
    frmPopup.popup.Navigate(_popupUrl)
    frmPopup.Show()
  End Sub

  Private Sub browserComp_NewWindowRequest(ByVal sender As Object, ByVal e As WebKit.NewWindowRequestEventArgs) Handles browserComp.NewWindowRequest
    e.Cancel = False
    _popupUrl = browserComp.Url.ToString  ' WHERE can I get the clicked URL? This is the old one of the remaining window
  End Sub
End Class

Code Form2

Public Class frmPopup

End Class
Foi útil?

Solução

Following popup/new-Window-Create-function works for me:

Private Sub browserComp_NewWindowCreated(ByVal sender As Object, ByVal e As WebKit.NewWindowCreatedEventArgs) Handles browserComp.NewWindowCreated
    frmPopup.Text = "POPUP"
    Dim popupBrowser As WebKit.WebKitBrowser
    popupBrowser = e.WebKitBrowser
    frmPopup.Controls.Add(popupBrowser)
    frmPopup.Show()
End Sub

whereas frmPopup is a new form.

Before I tried this I already added the Webkit-component to the new form, which might had been the problem. I assume, the trick is, to create a new WebKitBrower-element that is directly connected to the argument e.WebkitBrowser instead of overloading an existing webkitbrowser-component in the form. Don't ask me for reasons for this now (I really don't know) :P

Oh, I should add that I used the Webkit.NET component. The same trick works also for the OpenWebkitSharp-wrapper

The hint-problem still remains ...

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top