Skybound Software is looking to hire experienced C# developers to work on Stylizer and other forthcoming Skybound products. Click here for details.
GeckoFX is an open-source component which makes it easy to embed Mozilla Gecko (Firefox) into any .NET Windows Forms application. Written in clean, fully commented C#, GeckoFX is the perfect replacement for the default Internet Explorer-based WebBrowser control. Download GeckoFX @ Google Code >
GeckoFX is made by Skybound Software, authors of Stylizer—the professional CSS editor with a strong focus on visual control, error-free workflow, and productivity. Learn About Stylizer >
Discuss GeckoFX, the Open-Source Gecko Control for .NET
You are not logged in.
Pages: 1
Hey all
I am new here i am working on my project web browser i have implement Geckofx and xulrunner in my browser but it was single window (not multiple tab).
Here i seen TAB browser code to implement my project so i use code post in here.
I am facing few problem for which need help
1) Address Bar (Textbox) show only first tab URL
Its should change as i select different tab
2)Progress Bar also show only first tab activity even my Status text also.
Its should change for all TAB
3)Where should i put code of favicon code so for every time i tab select it should change according address in my Address bar (Textbox)
Favicon code where should i put so it will work properly
Code was working properly for single window web browser what should i do to make work for TAB
Private Sub Wb_Navigating(ByVal sender As System.Object, ByVal e As Skybound.Gecko.GeckoNavigatingEventArgs) Handles Wb.Navigating
Dim oURL As Uri = New Uri(e.Uri.AbsoluteUri)
Dim favicon As Image
If oURL.HostNameType = UriHostNameType.Dns Then
Dim iconURL As String = "http://" & oURL.Host & "/favicon.ico"
Dim request As System.Net.WebRequest = HttpWebRequest.Create(iconURL)
Dim response As HttpWebResponse = request.GetResponse
Dim stream As IO.Stream = response.GetResponseStream
favicon = Image.FromStream(stream)
If favicon Is Nothing Then
Dim result As String = String.Empty
Dim browser As New GeckoWebBrowser
For Each element As GeckoElement In browser.Document.DocumentElement.GetElementsByTagName("link")
If element.GetAttribute("REL") = "SHORTCUT ICON" Then
result = element.GetAttribute("HREF")
End If
Next
Dim req As WebRequest = HttpWebRequest.Create(result)
Dim res As HttpWebResponse = req.GetResponse
Dim str As IO.Stream = res.GetResponseStream
favicon = Image.FromStream(str)
End If
Me.PictureBox1.Image = favicon
End If
End Sub4)How add search bar.
5)How to implement download manager.
here code i have use for my tab
Please i am noob give me proper guild how to implement TAB because what ever change i make it only get applicable to single tab
Imports Skybound
Imports Skybound.Gecko
Imports System.Net
Public Class Form1
Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Skybound.Gecko.Xpcom.Initialize("C:\xulrunner")
'Create new tabpage
Dim NewTab As New TabPage("about:blank")
'Assign a unique name to identify it
NewTab.Name = "NewTab"
'Create new GeckoWebBrowser instance
Dim Browser As New Skybound.Gecko.GeckoWebBrowser
Browser.Name = "Browser"
'Fill entire tabpage
Browser.Dock = DockStyle.Fill
'Assign events
AddHandler Browser.CanGoBackChanged, AddressOf BrowserCanGoBack_Changed
AddHandler Browser.CanGoForwardChanged, AddressOf BrowserCanGoForward_Changed
AddHandler Browser.DocumentTitleChanged, AddressOf BrowserDocumentTitle_Changed
AddHandler Browser.ProgressChanged, AddressOf Browser_ProgressChanged
AddHandler Browser.Navigated, AddressOf BrowserNavigated
'Add browser to tabpage
NewTab.Controls.Add(Browser)
'Add tabpage to tabcontrol
BrowserTabs.TabPages.Add(NewTab)
Browser.Navigate("http://www.google.com/")
End Sub
Private Sub BrowserCanGoBack_Changed(ByVal sender As Object, ByVal e As System.EventArgs)
'The sender is the browser.
Dim SelectedBrowser As Skybound.Gecko.GeckoWebBrowser = sender
'MsgBox("The BrowserCanGoBack event was raised. " & SelectedBrowser.CanGoBack.ToString)
End Sub
Private Sub BrowserCanGoForward_Changed(ByVal sender As Object, ByVal e As System.EventArgs)
'The sender is the browser.
Dim SelectedBrowser As Skybound.Gecko.GeckoWebBrowser = sender
'MsgBox("The BrowserCanGoForward event was raised. " & SelectedBrowser.CanGoForward.ToString)
End Sub
Public Sub BrowserDocumentTitle_Changed(ByVal sender As Object, ByVal e As System.EventArgs)
'The sender is the browser.
Dim SelectedBrowser As Skybound.Gecko.GeckoWebBrowser = sender
'Set the tabpage text by getting the parent of the browser control
SelectedBrowser.Parent.Text = SelectedBrowser.DocumentTitle
End Sub
'-----------------------------------------------------------------------------------------------------------------------------------
'THIS NOT WORKING FOR EVERY TAB
Private Sub BrowserNavigated(ByVal sender As Object, ByVal e As System.EventArgs)
Dim SelectedBrowser As Skybound.Gecko.GeckoWebBrowser = sender
BTAddress.Text = SelectedBrowser.Document.Url.ToString
End Sub
'-----------------------------------------------------------------------------------------------------------------------------------
'THIS NOT WORKING FOR EVERY TAB
Private Sub Browser_ProgressChanged(ByVal sender As System.Object, ByVal e As Skybound.Gecko.GeckoProgressEventArgs)
ProgressBar.Maximum = e.MaximumProgress
ProgressBar.Value = e.CurrentProgress
End Sub
Private Sub BrowserTabsAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BrowserTabsAdd.Click
'Create new tabpage
Dim NewTab As New TabPage("about:blank")
'Assign a unique name to identify it
NewTab.Name = "NewTab"
'Create new GeckoWebBrowser instance
Dim Browser As New Skybound.Gecko.GeckoWebBrowser
Browser.Name = "Browser"
'Fill entire tabpage
Browser.Dock = DockStyle.Fill
'Assign events
AddHandler Browser.CanGoBackChanged, AddressOf BrowserCanGoBack_Changed
AddHandler Browser.CanGoForwardChanged, AddressOf BrowserCanGoForward_Changed
AddHandler Browser.DocumentTitleChanged, AddressOf BrowserDocumentTitle_Changed
'Add browser to tabpage
NewTab.Controls.Add(Browser)
'Add tabpage to tabcontrol
BrowserTabs.TabPages.Add(NewTab)
Browser.Navigate("http://checkip.dyndns.org/")
End Sub
Private Sub BrowserTabsRemove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BrowserTabsRemove.Click
If Not BrowserTabs.TabPages.Count = 1 Then
BrowserTabs.TabPages.RemoveAt(BrowserTabs.SelectedIndex)
BrowserTabs.SelectTab(BrowserTabs.TabPages.Count - 1)
End If
End Sub
Private Sub BrowserTabsGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BrowserTabsGo.Click
CType(BrowserTabs.SelectedTab.Controls.Item(0), GeckoWebBrowser).Navigate(BTAddress.Text)
'Browser.Navigate.BTAddress.Text()
End Sub
Private Sub BrowserTabsRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BrowserTabsRefresh.Click
CType(BrowserTabs.SelectedTab.Controls.Item(0), GeckoWebBrowser).Reload()
End Sub
Private Sub BrowserTabsStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BrowserTabsStop.Click
CType(BrowserTabs.SelectedTab.Controls.Item(0), GeckoWebBrowser).Stop()
End Sub
End ClassFor single window i get lot basic thing work
I will use this thread for future problems
SO PLEASE HELP ME :)
AND IS THERE ANY STANDER HELP HOW TO USE GECKOFX IN VB.NET
Last edited by rock_star (November 20, 2009 3:52 AM)
Offline
No Help :rolleyes: :(
EDIT:
Finally I solve my own Problem :P
that will put URL name in text box as soon as document finish loading ;)
Just Add this line to your Tabcontrol
AddHandler Browser.DocumentCompleted, AddressOf Browser_Nav
Private Sub Browser_Nav(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BrowserTabs.Selected
Dim i As Integer
i = i + i
BTAddress.Text = CType(BrowserTabs.SelectedTab.Controls.Item(i), GeckoWebBrowser).Document.Url.ToString
End SubNow please above Problems are still there so help
and i need to now how to make limit tab name like in firefox if it to long "Title Window..." come in end
and fix size of tab :rolleyes:
Last edited by rock_star (November 20, 2009 7:41 AM)
Offline
:/ No one here can help bad :|:(
Offline
Ok let me see if I can help you with creating a tabbed web browser, its pretty much like what my previous web browser project did in visual basic.net, especially when I had used it with popfly , the fun website that was around last summer with mashups, etc. In visual basic.net with a web browser project form1 will have the web browser control and other controls, etc. Ok about a tabbed browser for example you need 2 windows forms, form 1 has the web browser control 1 in a tabcontrol, form2 is going to be identical with web browser control 2 also in a tabcontrol. Both Windows forms are going to pretty much be the same with all controls along with maybe some differences. Somewhere in the code for form1 when your test running your web browser if you click perhaps a button to create a new tab with a browser window whats going to really happen is that the web browser control 2 from form2 will somehow appear in a new tab inside the tabcontrol that resides on form1, part of the trick has to do with using a dim statement. In form1 I had created my own subroutine that had the code that would allow the web browser to create a new tab with a browser window along with navigating controls, etc. First check out the code I used for form1:
Sub MerlinsSpoon()
' Need to create 3 special arrays that will prevent conflicts between each tabpage, in this case
' I call them magic pages.
' Each tabpage will be assigned a special tag with a name and number
Dim MysticNumber As Integer
Dim MysticTransform As Object
Dim MysticName As Object
Dim Magicball As New MagicStar ' This creates a new clone of the existing MagicPage (MagicStar was form2)
' This is name is set to help the pc locate any magicpage or tabpage for navigating to website
MysticNumber = MysticNumber + 1 ' special counting variable
MysticTransform = MysticNumber ' Converting integer variable into an object variable
MysticName = "MagicPage" & MysticTransform
' Type the code here to create a new magicpage
Magicball.MagicPage1.Name = MysticName
MagicLamp.TabPages.Add(Magicball.MagicPage1)
End Sub
Form2 will have about or almost the same identical code as form1, but of course their could be other ways that I don't know about, I like to be creative with code; I sometimes call it creative problem solving. :P
I know my code may look funny and confusing but it worked for me, anyways MagicLamp would be the tabcontrol on form1 and MagicPage1 would be the tabcontrol on form2, I hope this helps, don't lose hope, take your time, programming can be a fun learning experience. :D Plus In case your still confused and lost Im going to add the code file called: MagicStar.vb, its not perfect since I still have to debug it further but it can be used as a guideline or reference, etc. which was actually form2, part of the code uses the microsoft speech object library which had a reference set to it so my computer could say to the user for example hello via voice, etc. :cool:
Offline
Thanks Mate :)
Offline
Pages: 1