youssefsherif
Streaming Star
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2022
12:56 AM
how can i use the bounding rect to obtain width and height to be dynamically used in label?
1 Solution
Accepted Solutions
renojim
Community Streaming Expert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2022
01:14 AM
It's not clear what you're asking. Set the label text to something and then use boundingRect() to get the size of the label as displayed on the screen:
label = CreateObject("roSGNode", "Label")
label.text = "Some text"
w = label.BoundingRect().width
h = label.BoundingRect().height
If you've set the label's width and height to something then BoundingRect() will just return those values.
Roku Community Streaming Expert
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
2 REPLIES 2
renojim
Community Streaming Expert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2022
01:14 AM
It's not clear what you're asking. Set the label text to something and then use boundingRect() to get the size of the label as displayed on the screen:
label = CreateObject("roSGNode", "Label")
label.text = "Some text"
w = label.BoundingRect().width
h = label.BoundingRect().height
If you've set the label's width and height to something then BoundingRect() will just return those values.
Roku Community Streaming Expert
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
youssefsherif
Streaming Star
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2022
02:32 AM
Re: how can i use the bounding rect
thank you so much