thomsebastin
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2017
04:41 AM
Hide an element in Roku?
How do I hide an XML element using brightscript?
I am currently using
but this behave like "visibility:hidden" (the element is hidden, but the space is preserved). I am after something like "display: none" where the element is hidden and space is not preserved. I have also used removeChild(), but I find it a bit tedious as I have to find the parent and then find the index of child I want to hide.. Any other easy alternative?
I am currently using
m.myElement.visible = false
but this behave like "visibility:hidden" (the element is hidden, but the space is preserved). I am after something like "display: none" where the element is hidden and space is not preserved. I have also used removeChild(), but I find it a bit tedious as I have to find the parent and then find the index of child I want to hide.. Any other easy alternative?
3 REPLIES 3
joetesta
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2017
11:46 AM
Re: Hide an element in Roku?
if you don't want to remove the child you could try setting its height / width to 0 so that it's not taking up space
aspiring
thomsebastin
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2017
11:41 PM
Re: Hide an element in Roku?
"joetesta" wrote:
if you don't want to remove the child you could try setting its height / width to 0 so that it's not taking up space
That's what I have been doing right now. But sometimes it doesn't just work. While typing this, It just occurred to me that the item spacing might be the reason for it to not remove the space. Appreciate your help. I will try without item spacing and see how that works out.
Edit: Tried setting the height & width to 0. Doesn't just work. Tried setting the maxLines to 0, tried removing all the properties of the "Label". Turns out even the mere existence of "Label" tag without any properties add space. Is there a scenario where setting height & width to 0 doesn't work? Has anyone had any success with it? I am trying this on a "Label" tag.
thomsebastin
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2017
12:45 AM
Re: Hide an element in Roku?
Setting the height to -1 (on .brs file) and setting it back to 0 when needed to be shown, works for me in my case. You can either set height or width to -1 to suit your use case. No problems as of now. If I bump into any problems w.r.t this, I will update here. Thanks.