label height expand totext height

exjey

Member
Licensed User
Longtime User
Hello, i 've tried some resources found in here, but i didnt make it, maybe is something with the measurement units.

I have a Panel attached into a Scrollview. I have also an image aligned left-up to that panel, and a label placed to the right of the image. Both a childs of the Panel, which is child of the scrollview.

What is the correct command to set the Panel Height and the Label.Height to the corresponding label.text.I want all the text to be shown and its not a constant, it changes, thats why i need to calculate programmatically both Label and ofcourse panel heights (scrollview height is maximied to the device's Y resolution).
 

yttrium

Active Member
Licensed User
Longtime User
Hello, i 've tried some resources found in here, but i didnt make it, maybe is something with the measurement units.

I have a Panel attached into a Scrollview. I have also an image aligned left-up to that panel, and a label placed to the right of the image. Both a childs of the Panel, which is child of the scrollview.

What is the correct command to set the Panel Height and the Label.Height to the corresponding label.text.I want all the text to be shown and its not a constant, it changes, thats why i need to calculate programmatically both Label and ofcourse panel heights (scrollview height is maximied to the device's Y resolution).

To access height of the panel used by a scrollview, you simply write
B4X:
Scrollview.Panel.Height = MyLabel.Height
Filling in Scrollview with the name of your ScrollView, and Panel with the name of your Panel.
 
Last edited:
Upvote 0

exjey

Member
Licensed User
Longtime User
This sub if for "multiline" text, correct? It means, text lines divided by "CRLF" i think. But what about a label (100,0,200,?) which contains a non multiline text, but the label does a word wrapping successfully. How then i will calculate the height?
 
Upvote 0

yttrium

Active Member
Licensed User
Longtime User
This sub if for "multiline" text, correct? It means, text lines divided by "CRLF" i think. But what about a label (100,0,200,?) which contains a non multiline text, but the label does a word wrapping successfully. How then i will calculate the height?

I believe the multiline example works for both. It calculates actual text height, versus might which calculates predetermined label height.
 
Upvote 0
Top