B4J Question Adding node to scrollpane

Big JR

Member
Licensed User
Longtime User
How do I programatically add a button to a scrollpane rather than to the rootpane? I've dragged a scrollpane onto the layout, given it an id of sp1. I can use addnode to add a button to the main anchorpane but don't know how add a node to the scrollpane instead.
 

Big JR

Member
Licensed User
Longtime User
You should just call ScrollPane1.AddNode(...)

You will need to change the variable type to Pane as ScrollPane will not be recognized.

I'm getting errors.

In process globals I have:

Dim Scrollpane1 As Pane


In the action for a button outside the scrollpane I have:

Dim ThisBtn As Button

ThisBtn.Initialize("ThisBtn")

ThisBtn.Tag = "2"

ThisBtn.Text = "Play #1"

Scrollpane1.AddNode(ThisBtn, 10, 10, 60, 40)
 
Upvote 0

mikeeepe

Member
Licensed User
Longtime User
I am trying to add controls to a scrollpane, but there doesn't seem to be an option to add to the innernode. See attached program. I want to add the time spinners to the scroll pane.

Any ideas?
 

Attachments

  • WhiteSheet.zip
    60.9 KB · Views: 379
Upvote 0

ilan

Expert
Licensed User
Longtime User

sorry erel but your answer there is not clear enough (at least for me).

i have created in designer a pane and i would like to add it to the scrollpane but i get an error.

B4X:
    Dim p As Pane
    p.Initialize("")
    p = leftscrollp.InnerNode
    p.AddNode(menupnl,0,0,leftscrollp.Width,leftscrollp.Height)


what am i doing wrong?
 
Upvote 0

BeneBarros

Active Member
Licensed User
Longtime User
menupn1.initialize("")
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
such a simple think but cannot find anywhere in the forum a solution...

just want to add a complete pane to the scrollpane and scroll vertical...
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
ok i solved it in a different way, just created a layout with only that pane and i am loading the layout to the scrollpane, but still i would like to know how i can make it without creating a new layout...
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
Upvote 0

ilan

Expert
Licensed User
Longtime User
Sorry but you wrote in the link you posted to do it like this.. maybe i understood it wrong

Ok i will try, thank you erel
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…