Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
joetesta
Roku Guru

how to obtain computed height of Label ?

Sorry for the double posts.  I need help and the docs appear to be wrong, so I'm covering the bases.
https://sdkdocs.roku.com/display/sdkdoc ... lAlignment
How does one obtain the computed height?  I've tried every scenario of setting heights and numlines and maxlines to zero and non-zero.  
Whenever I set height 0, after dynamically assigning the text and retrieving the component's height, it is always 0, regardless of numlines being non-zero or maxlines being non-zero.
please help?
aspiring
0 Kudos
3 REPLIES 3
RokuNB
Roku Guru

Re: how to obtain computed height of Label ?

"joetesta" wrote:
Whenever I set height 0, after dynamically assigning the text and retrieving the component's height, it is always 0,

What makes you think that it will change?
Perhaps you are mis-reading, the doco text you link to talks about "computed height" value, how it is done - does not imply that would be exposed to you though - and even if it is, i am pretty sure that won't be back in "height". Have you tried boundingRectangle and other such? (disclaimer: i am talking unprepared on the subject)
0 Kudos
joetesta
Roku Guru

Re: how to obtain computed height of Label ?

"RokuNB" wrote:
"joetesta" wrote:
Whenever I set height 0, after dynamically assigning the text and retrieving the component's height, it is always 0,

What makes you think that it will change?
Perhaps you are mis-reading, the doco text you link to talks about "computed height" value, how it is done - does not imply that would be exposed to you though - and even if it is, i am pretty sure that won't be back in "height". Have you tried boundingRectangle and other such? (disclaimer: i am talking unprepared on the subject)

I don't necessarily think it will change, but this computed height might be useful for layouts, no?  I did look at boundingRect and that didn't seem to have any useful info, I'll go double check in a few.  I need to put a UI element under this variable height paragraph and unfortunately it seems I cannot use simple Label component.  Now I believe it's not exposed, which sucks. But maybe, hopefully I'm wrong?
aspiring
0 Kudos
joetesta
Roku Guru

Re: how to obtain computed height of Label ?

boundingRect() works after all! Seems it's just a matter of looking at boundingRect() after the dynamic text is set.
Thanks RNB, you are the best!
aspiring
0 Kudos