iOS Question b4i browser sample

dnaci

Member
Licensed User
Longtime User
Hello. I need a b4i web browser example. Thanks.

Solved. I used the following codes:

'Code module
#Region Project Attributes
#ApplicationLabel: B4i Example
#Version: 1.0.0
'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
#iPhoneOrientations: Portrait, LandscapeLeft, LandscapeRight
#iPadOrientations: Portrait, LandscapeLeft, LandscapeRight, PortraitUpsideDown
#End Region

Sub Process_Globals
'These global variables will be declared once when the application starts.
'Public variables can be accessed from all modules.
Public App As Application
Public NavControl As NavigationController
Private Page1 As Page

Private WebView1 As WebView
Private Button1 As Button
Private TextField1 As TextField
End Sub

Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page")
Page1.RootPanel.LoadLayout("main")
NavControl.ShowPage(Page1)
'Dim fileName As String = "homepage.html"
'WebView1.LoadUrl("file://" & File.Combine(File.DirAssets, fileName))
WebView1.LoadUrl("file://" & File.Combine(File.DirAssets, "homepage.html"))
End Sub

Private Sub Page1_Resize(Width As Int, Height As Int)

End Sub

Private Sub Application_Background

End Sub

Sub WebView1_OverrideUrl (Url As String) As Boolean
'App.OpenURL(Url)
'Return True
End Sub

Sub Button1_Click
WebView1.LoadUrl(TextField1.Text)
End Sub
 
Last edited:

Mushari Alashqar

New Member
Licensed User
B4X:
#Region Project Attributes 
#ApplicationLabel: B4i Example
#Version: 1.0.0 
'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
#iPhoneOrientations: Portrait, LandscapeLeft, LandscapeRight
#iPadOrientations: Portrait, LandscapeLeft, LandscapeRight, PortraitUpsideDown
#End Region

Sub Process_Globals
'These global variables will be declared once when the application starts.
'Public variables can be accessed from all modules.
Public App As Application
Public NavControl As NavigationController
Private Page1 As Page

Private WebView1 As WebView
Private Button1 As Button
Private TextField1 As TextField
End Sub

Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page")
Page1.RootPanel.LoadLayout("main")
NavControl.ShowPage(Page1)
'Dim fileName As String = "homepage.html"
'WebView1.LoadUrl("file://" & File.Combine(File.DirAssets, fileName))
WebView1.LoadUrl("file://" & File.Combine(File.DirAssets, "homepage.html"))
End Sub

Private Sub Page1_Resize(Width As Int, Height As Int)

End Sub

Private Sub Application_Background

End Sub

Sub WebView1_OverrideUrl (Url As String) As Boolean
'App.OpenURL(Url)
'Return True
End Sub

Sub Button1_Click
WebView1.LoadUrl(TextField1.Text)
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…