iOS Question Layout not loading in ScrollView with iTabStrip

aaronk

Well-Known Member
Licensed User
Longtime User
Hi,

I am using the iSideMenu with a iTabStrip and trying to use a scrollview in one of the tabs but can't work out why the layout isn't loading in the scrollview.

I have attached my test project.

Any ideas on where I have gone wrong ?

Main:
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 Page1 As Page
    Public smc As SideMenuController    'iSideMenu Lib
End Sub

Private Sub Application_Start (Nav As NavigationController)
    'SetDebugAutoFlushLogs(True) 'Uncomment if program crashes before all logs are printed.
    NavControl = Nav
    
    
    NavControl.Initialize("")
    Dim lp As Page
    lp.Initialize("lp")
    lp.RootPanel.Color = Colors.Red
    lp.RootPanel.LoadLayout("LeftMenu")
    smc.Initialize(lp, NavControl, Null)
    smc.OpenGesturesEnabled = False
    App.KeyController = smc
    NavControl.NavigationBarVisible = False
    MyPage2.show(NavControl)    ' this will show the login screen
    
End Sub

MyPage2:
B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'Public variables can be accessed from all modules.
    Private MainPage As Page
    Private TabStripPanel As Panel
    Private TabPages As List
    Private TabPage1, TabPage2, TabPage3 As Page

    Private TabStrip1 As TabStrip
    Private ScrollView1 As ScrollView
End Sub

Public Sub Show(Parent As NavigationController)
    
    If MainPage.IsInitialized = False Then
        ' Main Page
        MainPage.Initialize("MainPage")
        MainPage.Title = "Page 1"
        MainPage.RootPanel.Color = Colors.White
        MainPage.RootPanel.LoadLayout("Main")
    End If
    Parent.ShowPage(MainPage)
    
    TabStripPanel.LoadLayout("TabStripLayoutOnly")
        
    TabPages.Initialize
    
    TabPage1.Initialize("TabPage1")
    TabPage1.RootPanel.LoadLayout("Tab1Layout")
    TabPage1.Title = "1"
    TabPages.Add(TabPage1)
    
    TabPage2.Initialize("TabPage2")
    TabPage2.RootPanel.LoadLayout("Tab2Layout")
    TabPage2.Title = "2"
    TabPages.Add(TabPage2)

    TabPage3.Initialize("TabPage3")
    TabPage3.RootPanel.LoadLayout("ScrollViewLayout")
    ScrollView1.Panel.LoadLayout("Tab3Layout")
    TabPage3.Title = "3"
    TabPages.Add(TabPage3)
    
    TabStrip1.SetPages(TabPages)

End Sub
 

Attachments

  • testProject.zip
    12.9 KB · Views: 236

aaronk

Well-Known Member
Licensed User
Longtime User
Why aren't you creating the TabStrip only when MainPage.IsInitialized is False?
Looks like I forgot to move it to that part in the code. I originally did have it in that section in my code, but when I was playing around I guess I moved it there by mistake.

You need to set the ContentWidth. It cannot be 0.
Something so simple but easy to forget to check. Changed it as the code you posted and it fixed the issue. (I kept changing the height but forgot to check the width)
 
Upvote 0
Top