iOS Question TabStrip error

rfresh

Well-Known Member
Licensed User
Longtime User
I'm trying to have a look at the TabStrip example but am getting an error on line 33 which has to do with the Main designer file.

I'm not sure what the problem is.

Thank you...

Three attachments below.
 

Attachments

  • 2019-07-14_093839.png
    2019-07-14_093839.png
    46.8 KB · Views: 329
  • 2019-07-14_093809.png
    2019-07-14_093809.png
    16.2 KB · Views: 320
  • TabStrip.zip
    112.6 KB · Views: 346

rfresh

Well-Known Member
Licensed User
Longtime User
OK, here is the error msg and the code:

Error message:

Application_Start
Error occurred on line: 33 (Main)
Target is null. Method called: _initialize:::
Stack Trace: (
CoreFoundation <redacted> + 252
libobjc.A.dylib objc_exception_throw + 56
CoreFoundation <redacted> + 0
B4i Example +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 192
B4i Example -[B4ICustomViewWrapper AfterDesignerScript] + 2076
B4i Example -[B4ILayoutBuilder loadLayout:::] + 2892
B4i Example -[B4IPanelWrapper LoadLayout::] + 204
B4i Example -[b4i_main _application_start:] + 1116
CoreFoundation <redacted> + 144
CoreFoundation <redacted> + 292
B4i Example +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1624
B4i Example -[B4IShell runMethod:] + 448
B4i Example -[B4IShell raiseEventImpl:method:args::] + 2172
B4i Example -[B4IShellBI raiseEvent:event:params:] + 1580
B4i Example __33-[B4I raiseUIEvent:event:params:]_block_invoke + 60
libdispatch.dylib <redacted> + 24
libdispatch.dylib <redacted> + 16
libdispatch.dylib <redacted> + 1068
CoreFoundation <redacted> + 12
CoreFoundation <redacted> + 1924
CoreFoundation CFRunLoopRunSpecific + 436
GraphicsServices GSEventRunModal + 104
UIKitCore UIApplicationMain + 212
B4i Example main + 124
libdyld.dylib <redacted> + 4
)

Code:

B4X:
'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
    #Target: iPhone, iPad
    #ATSEnabled: True
    #MinVersion: 7
#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 MainPage As Page

    'Private TabStrip1 As TabStrip
    Private WebView1 As WebView
    Private TabPages As List
End Sub

Private Sub Application_Start (Nav As NavigationController)
    'SetDebugAutoFlushLogs(True) 'Uncomment if program crashes before all logs are printed.
    Dim nc As NavigationController
    nc.Initialize("nc")
    NavControl = nc
    'NavControl = Nav
    MainPage.Initialize("MainPage")
    MainPage.RootPanel.LoadLayout("Main")
    NavControl.ShowPage(MainPage)
    TabPages.Initialize
    Dim cs As CSBuilder
    Dim page1, page2, page3 As Page
   
   
    page1.Initialize("page1")
    page1.RootPanel.LoadLayout("Tab1")
    page1.Title = "Bing"
    WebView1.LoadUrl("https://www.bing.com")
    TabPages.Add(page1)
   
    page2.Initialize("page2")
    page2.RootPanel.LoadLayout("Tab1")
    WebView1.LoadUrl("https://www.google.com")
    cs.Initialize.Font(Font.CreateFontAwesome(18)).Color(0xFF014E1C).VerticalAlign(-1).Append("Google ").Append(Chr(0xF17B)).PopAll
    SetAttributedTitle(page2, cs)
    TabPages.Add(page2)
   
    page3.Initialize("page3")
    page3.RootPanel.LoadLayout("Tab1")
    WebView1.LoadUrl("https://www.duckduckgo.com")
    SetAttributedTitle(page3, cs.Initialize.Color(0xFFF46903).Append("DuckDuckGo").PopAll)
    TabPages.Add(page3)
       
    'TabStrip1.SetPages(TabPages)
   
End Sub

Sub TabStrip1_PageSelected (Position As Int)
    Log("Current page: " & Position)
End Sub

Sub SetAttributedTitle(page As Page, cs As CSBuilder)
    Dim lbl As Label
    lbl.Initialize("")
    lbl.AttributedText = cs
    page.TitleView = lbl
End Sub

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

Private Sub Application_Background
   
End Sub
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
I was getting an error re a missing lib if I uncommented this line:

B4X:
Private TabStrip1 As TabStrip

I'm currently using the iSideMenu.
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
I'm trying to find a component that will give me some kind of Tab or Menu system. Apparently I need a lib reference to use TabStrip but I don't know where to find it so I can use it.
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
The line below has the red saw tooth underline and the msg is:

Unknown type: tabstrip
Are you missing a library reference?

B4X:
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 MainPage As Page

    Private TabStrip1 As TabStrip '<--------------

    Private WebView1 As WebView
    Private TabPages As List
End Sub
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
That's the problem, there is no iTabStrip listed in the libraries tab.
 

Attachments

  • 2019-07-19_080612.jpg
    2019-07-19_080612.jpg
    29.2 KB · Views: 294
Upvote 0
Top