B4J Question ScrollPane inner height

ThRuST

Well-Known Member
Licensed User
Longtime User
How do I properly set the height of the scrollable pane in Y direction when loading the ScrollPane with LoadLayout? I know it doesn't really matter if it's it's scrolling in X or Y direction, but for this specific question I want to scroll in Y direction based on the pane's height, which can be set with innerheight as well.

Edit: I made a little source code example called ScrollPane you can try. Since Vpanel's height must correspond with the LoadLayout 2nd parameter I would like to grab the Vpanel's height and use it in LoadLayout, but perhaps that's not a preferable way. Comments are welcome and alternative solutions. Is there no need to set the nodes InnerHeight value? This is all autoscaling so it should work on any resolution.

Thanks
 

Attachments

  • ScrollPane.zip
    21 KB · Views: 327
Last edited:

ThRuST

Well-Known Member
Licensed User
Longtime User
I made a source code example. Please comment how the Anchors impact the scrollpane, since scrolling changes depending on their settings. See screenshot.
These settings can make adjustment together with setting the InnerWidth and InnerHeight a bitch to get right. So it doesn't hurt to clear these things out.

How does these anchors work? Where can I find specification on this how they work with the ScrollPane?

anchors.JPG
 
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
Anchors functionality what do they do there's a couple of combinations, autosize with -1, InnerWidth, InnerHeight, LoadLayout parameters, Pane's width and height must correspond with the values in LoadLayout. These needs to be explained more clearly as the combinations causes tidious work. Thanks
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
There is nothing special between the anchors and the ScrollPane.

When you load the layout to the inner panel, it doesn't "know" that it is inside a ScrollPane. The layout is loaded to a panel with the size you set in the LoadLayout call.

As a general rule, the layout is loaded and resized based on the container size. The container is never resized when you load a layout.
 
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
Thanks for pointing this out. I hope my example can be of help for someone since it works in case the combinations of settings might cause confusion how ScrollPane works.

As the InnerPane Width and Height can be set manually, but this is not neccessary since it is specified with parameters when loading the layout.
 
Upvote 0
Top