B4J Question scrollpane empty

ivanomonti

Expert
Licensed User
Longtime User
we always fight, but what's wrong with this code? because when I want to add a scrollpane I always have the same problem, :-(

B4X:
#Region Project Attributes
    #MainFormWidth: 600
    #MainFormHeight: 600
#End Region

Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private Pane1 As Pane
    Private Button1 As Button
    Private bs As biscotto
    Private ScrollPane1 As ScrollPane
    
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    
    MainForm = Form1
    MainForm.RootPane.LoadLayout("Layout1")
    MainForm.Title = "Biscotto"
    MainForm.Show

    bs.Initialize()
    
End Sub

Sub AppInit
    
    If ScrollPane1.IsInitialized Then
        ScrollPane1.Initialize("ScrollPane1")
    End If

    If Pane1.IsInitialized = False Then
        Pane1.Initialize("Pane1")
    End If

    Pane1 = ScrollPane1.InnerNode
    
    For i = 0 To 10
        bs.AddPane(Pane1)
    Next
    
End Sub

'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
    Return True
End Sub

Sub Button1_Click
    AppInit
End Sub
 

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
Hi!

Invert this:

Pane1 = ScrollPane1.InnerNode

Scrollpane doesnt have to be initialized (if added by designer). Nor the inner node.
 
Upvote 0

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
Shouldn't this be = false?

If ScrollPane1.IsInitialized Then
ScrollPane1.Initialize("ScrollPane1")
End If
 
Upvote 0
Top