iOS Question Scrollview as B4XView

App Dude

Active Member
Licensed User
Longtime User
I'm using a scrollview in B4A as a B4XView, then loading a new panel (created as a separate screen in the designer) into that scrollview. Works well.
Now in B4i, the same code crashes when I do the same thing:
B4X:
    svScn1.Top = 120dip
    svScn1.Left = 0dip
    svScn1.Width = 100%x
    svScn1.Height = 100%y-50dip
    svScn1.GetView(0).LoadLayout("Screen1Panel")

The top of the crash shows this...
B4X:
Error occurred on line: 99 (B4XMainPage)
Expected: B4IPanelView, object type: UIScrollView
Stack Trace: (

I found examples on this forum of how to do this if I define the svScn1 as a ScrollView, and then I can load the panel into the scrollview with svScn1.Panel.LoadLayout("Screen1Panel"). But not as a B4XView. Any idea how to do this?

Thanks.
 

mcqueccu

Well-Known Member
Licensed User
Longtime User
Both B4A and B4i have scrollview. You don't need to declare it as B4XView before you can use it. And they work closely similar.

You can load your layout in both platforms using this same code
B4X:
svScn1.Panel.LoadLayout("YOur layout")
 
Upvote 0

App Dude

Active Member
Licensed User
Longtime User
Shouldn't there be a way to do this as a B4XView? Because changing to a Scrollview would change much of my other code. (The Android code is already done and working).
 
Upvote 0
Top