B4J Question Pane inside scrollpane

Chris Guanzon

Active Member
Licensed User
Longtime User
Hello, how to auto resize pane inside the scroll pane when resizing the form? I've anchored the pane and the scroll pane, but the pane is not resizing according to the size of the scroll pane.

attached file is the sample code.
 

Attachments

  • test1.zip
    2.8 KB · Views: 308

Chris Guanzon

Active Member
Licensed User
Longtime User
Don't confuse the ScrollPane dimensions with the ScrollPane inner panel dimensions. There is no relation between the two.

The whole idea of using ScrollPane is that it allows you to set the internal width and height to larger values.


Is scrollpane not like scrollpanel in b4a? I want the panel to auto-resize if i resize the form. The reason why i used the scroll pane is because I have a layout with panel and inside the panel are textfields, labels, comboboxes etc. Now, the 800x600 variant is not enough for all the views I've added (it is for registration actually). I want the user to use the scroll and also to resize the conponents inside the panel when the user resize the form. Or Is there other way to do it?
 
Upvote 0

Chris Guanzon

Active Member
Licensed User
Longtime User
It is the same as ScrollView. The mistake you made is that you set the inner panel size to MainForm.Width and MainForm.Height. The correct size should be the absolute size of the internal layout.


How can I do that? If I change the width and the height to this
B4X:
 ScrollPane1.LoadLayout("Layout2", 800, 1600)
. The height is ok but the width is not ok, it is not resizing according to the form width.
 
Upvote 0

Chris Guanzon

Active Member
Licensed User
Longtime User
The inner panel size shouldn't be resized. Never.

You need to decide on the size of Layout2 and set it. It if it is larger than the form size then the user will need to scroll it. This is exactly the reason for having a ScrollPane.

Thank you sir @Erel, will decide the size of my 2nd layout. thanks again so much.
 
Upvote 0
Top