B4J Question scrollpane won't scroll when adding nodes dynamically

Discussion in 'B4J Questions' started by le_toubib, Apr 4, 2015.

  1. le_toubib

    le_toubib Active Member Licensed User

    Hi again
    I'm adding an array of nodes into the innerpane of a scroll pane.
    but as the inner pane grow taller, the scroll bar is not working, and the pane is not scrollable.
    what am I doing wrong ?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Can you post your code?
     
  3. le_toubib

    le_toubib Active Member Licensed User

    Solved by setting the inner hight of the inner node. Thanks erel
     
  4. ivanomonti

    ivanomonti Well-Known Member Licensed User

    examples!! possible
     
  5. le_toubib

    le_toubib Active Member Licensed User

    Code:
    InScroll1.AddNode(spns1(i), 0.05 * MainForm.Width , i * 130 + 80dip + lbls2(i).Height , 0.90 * MainForm.RootPane.Width, 0.07 * MainForm.Height)

    InScroll1.PrefHeight= spns1(Q_Count-
    1).Top + 200dip
    scroll1.Pannable=
    True
    in the first line i add a group of spinners (spns1(i) ) on top of each other.

    then i set the inner hight of inscroll1 to be 200dip more than the top of the last spinner added
     
  6. ivanomonti

    ivanomonti Well-Known Member Licensed User



    no result :-( mmm my error!!


    Code:
    Sub Process_Globals
        
    Private fx As JFX
        
    Private MainForm As Form
    End Sub

    Sub AppStart (Form1 As Form, Args() As String)
        MainForm = Form1
        
    'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
        MainForm.Show
       
        
    Dim l,t,w,h As Float
       
        
    Dim ap As ScrollPane
        ap.Initialize(
    "ap")
        
    Dim pn As Pane = ap.InnerNode
        MainForm.RootPane.AddNode(pn, 
    00, MainForm.Width/2, MainForm.Height)
       
        l = 
    10
        t = 
    0
        w = pn.Width-
    10
        h = 
    Rnd(32,50)
       
        
    For i = 0 To 100
            
    Dim pna As Button
            pna.Initialize(
    "pn")
            pna.Text = 
    "button " & i
            pn.AddNode(pna,l,t,w,h)
            t = t + h + 
    10
            h = 
    Rnd(100,200)
        
    Next
       
        ap.Pannable = 
    True
       
    End Sub
     
  7. le_toubib

    le_toubib Active Member Licensed User

    then , at the end u add :
    pn.PrefHeight = t + h + 10
    this will make it scrollable till 10px after the bottom of the last botton.
     
  8. ivanomonti

    ivanomonti Well-Known Member Licensed User

    mmmm no result :-(


    Code:
    #Region  Project Attributes
        
    #MainFormWidth: 600
        
    #MainFormHeight: 400
    #End Region

    Sub Process_Globals
        
    Private fx As JFX
        
    Private MainForm As Form
    End Sub

    Sub AppStart (Form1 As Form, Args() As String)
        MainForm = Form1
        
    'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
        MainForm.Show
       
        
    Dim l,t,w,h As Float
       
        
    Dim ap As ScrollPane
        ap.Initialize(
    "ap")
        ap.PrefHeight = MainForm.Height
        ap.PrefWidth = MainForm.Width/
    2
        ap.SetHScrollVisibility(
    "ALWAYS")
        ap.SetVScrollVisibility(
    "ALWAYS")
       
        
    Dim pn As Pane = ap.InnerNode
        pn.Style = cssIphoneToolsBar
        MainForm.RootPane.AddNode(pn, 
    00, MainForm.Width/2, MainForm.Height)
       
        l = 
    10
        t = 
    10
        w = (MainForm.Width/
    2)-20
        h = 
    Rnd(32,50)
       
        
    For i = 0 To 100
            
    Dim pna As Button
            pna.Initialize(
    "pn")
            pna.Text = 
    "button " & i
            pn.AddNode(pna,l,t,w,h)
            t = t + h + 
    10
            h = 
    Rnd(100,200)
        
    Next
       
        pn.PrefHeight = t + h + 
    10
       
        ap.Pannable = 
    True
       
    End Sub

    Sub cssIphoneToolsBar As String
        
    Dim s As String = "-fx-background-color: linear-gradient(#98a8bd 0%, #8195af 25%, #6d86a4 100%);"
        
    Return s
    End Sub
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice