ScrollView1=(MyScrollview):Layout not available

walterf25

Expert
Licensed User
Longtime User
i'm having a problem setting the height of a scrollview so that it adjusts to whatever the content of a label i tried measuring the height of the label using StrUtil like so

Dim su as Strul
su = MeasureMultilineTextHeight(Label1, StateModule.RepNames)
this works fine, so i try setting the height of the scrollview like this
scrollview1.panel.height = su + 20dip
physically i don't see any change when scrolling through the scrollview i don't see the height adjusting accordingly, i try debugging and i noticed that when i put my cursor over the line scrollview1.panel.height = su + 20dip it gives me this message "ScrollView1=(MyScrollview):Layout not available", does anyone know what this mean, i'm thinking this is the problem as to why setting the height for my scrollview is not working, any thoughts anybody!!!!!!


thanks,
Walter
:sign0163:
 

jnjft

Member
Licensed User
Longtime User
Hi Walter, it´s been a long time since you posted your problem, but if someone comes around it, like me (I just started working with B4A) - here´s what helped in my special case:

In my code I initialized a label at a place where it held information - initializing a label immediately resets it, so the ´layout not available´ error is raised when you try to use the values it had stored, like label.left or sth.
I then put the initializing of that label into the ´Sub Initialize´ of the module (it is a class module btw) and everything was fine.
As already said, this was the solution in my special case and as I couldn´t find anything helpful regarding the error message above - maybe this post can help someone else, too.

Have a nice day
 
Upvote 0
Top