Android Question Use Scrollview in B4a, And B4i

grant1842

Active Member
Licensed User
Longtime User
I am trying to use scrollview as follows
sub Class_Globals
Private ScrollView1 As B4XView

B4X:
#If B4A
    Private pnlScrollview As Panel
    Dim ScrollView1 As scrollview
    ScrollView1.Panel.LoadLayout("ScrollViewLayout")
    ScrollView1.Panel.Height = pnlScrollview.Height

#Else if B4J
xui.MsgboxAsync("None", "B4X")

#else if B4i
    
    Private pnlScrollview As B4XView
    pnlScrollview.IsInitialized
    ScrollView1.ScrollViewInnerPanel.LoadLayout("scrollview")
    ScrollView1.ScrollViewContentWidth = 100%x
    ScrollView1.ScrollViewContentHeight = pnlScrollview.Height
Code works fine in b4i but not b4a

i did remove
sub Class_Globals
Private ScrollView1 As B4XView


b4a gets error B4XMainPage - 73: Unknown member: panel
So my Private pnlScrollview As Panel is not working.

How can i use the scrollView as panel in b4a ?

Thanks for any help.
 

grant1842

Active Member
Licensed User
Longtime User
Klaus I did set
Private ScrollView1 As B4XView
Private pnlScrollview As B4XView

B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    
    
    Root = Root1
    Root.LoadLayout("MainPage")
    #If B4A
    pnlScrollview = ScrollView1.Panel
    ScrollView1.Panel.LoadLayout("scrollview")
    ScrollView1.Panel.Height = pnlScrollview.Height
    #Else If B4i
    pnlScrollview = ScrollView1.ScrollViewInnerPanel
    ScrollView1.ScrollViewInnerPanel.LoadLayout("scrollview")
    ScrollView1.ScrollViewContentWidth = 100%x
    ScrollView1.ScrollViewContentHeight = pnlScrollview.Height
    #End If
    vcustomers.Initialize
    vjobs.Initialize
    vbackup.Initialize
     vsettings.Initialize
    vcamara.Initialize
    vsettings.Initialize
    
    B4XPages.AddPage("camara", vcamara)
    B4XPages.AddPage("customers", vcustomers)
    B4XPages.AddPage("jobs", vjobs)
    B4XPages.AddPage("backup", vbackup)
    B4XPages.AddPage("settings", vsettings)
    B4XPages.AddPage("scrollview", vsettings)
    
End Sub

It compiles and works good in b4i but i get
Unknow member Panel still
Thanks for your help
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
No.
You should keep the difference between B4A and B4i.
B4X:
Private pnlScrollview As B4XView
#If B4A
    Private ScrollView1 As ScrollView
    pnlScrollView = ScrollView1.Panel
 #Else if B4J
    xui.MsgboxAsync("None", "B4X")
#Else If B4i
    Private ScrollView1 As ScrollView
    pnlScrollView = ScrollView1.ScrollViewInnerPanel
#End Id
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…