lisakb140
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2018
07:59 AM
Label Node Created in main.brs not rendering
I am creating a label in my main.brs with CreateObject, which I thought would be fairly simple. However, it is not rendering, and I have no idea why.
This happens within a function where I create a VideoNode via CreateObject, and that seems to show up fine.
My code is:
If I print label, I get this, which looks correct to me, but it just doesn't appear anywhere on the screen (as if visibility were false)! What am I missing?!
This happens within a function where I create a VideoNode via CreateObject, and that seems to show up fine.
My code is:
label = CreateObject("roSGNode", "Label")
label.text = "EPISODES AVAILABLE"
label.translation="[50, 50]"
label.numlines="1"
label.color="0xFFFFFF"
label.id = "episodeslabel"
If I print label, I get this, which looks correct to me, but it just doesn't appear anywhere on the screen (as if visibility were false)! What am I missing?!
<Component: roSGNode:Label> =
{
color: -1
displayPartialLines: false
ellipsisText: ""
ellipsizeOnBoundary: false
font: <Component: roSGNode:Font>
height: 0
horizAlign: "left"
isTextEllipsized: false
lineSpacing: 8
maxLines: 0
numLines: 1
text: "EPISODES AVAILABLE"
truncateOnDelimiter: ""
vertAlign: "top"
width: 0
wordBreakChars: ""
wrap: false
childRenderOrder: "last"
clippingRect: <Component: roAssociativeArray>
enableRenderTracking: false
inheritParentOpacity: true
inheritParentTransform: true
muteAudioGuide: false
opacity: 1
renderPass: 0
renderTracking: "disabled"
rotation: 0
scale: <Component: roArray>
scaleRotateCenter: <Component: roArray>
translation: <Component: roArray>
visible: true
change: <Component: roAssociativeArray>
focusable: false
focusedChild: <Component: roInvalid>
id: "episodeslabel"
}
9 REPLIES 9

squirreltown
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2018
10:27 AM
Re: Label Node Created in main.brs not rendering
I'd guess the color should be in this format "0x000000".
color: -1
Kinetics Screensavers
lisakb140
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2018
11:24 AM
Re: Label Node Created in main.brs not rendering
Yeah, I'm not sure why that prints like that. In my brs I specify
label.color="0xFFFFFF"

golewis
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2018
11:27 AM
Re: Label Node Created in main.brs not rendering
I think you need to add the label to the current view as a child object. Use findNode() to get the node to which you wish to add the child. Then use appendChild(). Reference here: Reference
Here's another way using createChild():
Here's another way using createChild():
m.grid = m.top.findNode("gridRowList")
m.fade = m.grid.CreateChild("MaskGroup")
m.fade.setFields({
id: "fadeMaskGroup"
maskuri: "pkg:/images/fade_3_sides.png"
masksize: "[1280,720]"
maskOffset: "[0,0]"
})
lisakb140
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2018
11:51 AM
Re: Label Node Created in main.brs not rendering
For some reason that throws a fatal error. I have:
I'm not sure why that crashes things-- it doesn't seem that unusual to me..
row = [i]createObject[/i]("RoSGNode","VideoNode")
label = [i]CreateObject[/i]("roSGNode", "Label")
label.[b]text[/b] = "EPISODES AVAILABLE"
row.appendChild(label)
I'm not sure why that crashes things-- it doesn't seem that unusual to me..
lisakb140
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2018
11:52 AM
Re: Label Node Created in main.brs not rendering
For some reason that throws a fatal error. I have:
I'm not sure why that crashes things-- it doesn't seem that unusual to me..
row = createObject("RoSGNode","VideoNode")
label = CreateObject("roSGNode", "Label")
label.text = "EPISODES AVAILABLE"
row.appendChild(label)
I'm not sure why that crashes things-- it doesn't seem that unusual to me..
lisakb140
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2018
12:54 PM
Re: Label Node Created in main.brs not rendering
I tried reworking this a little, annd now I'm getting a Type mismatch error (appending a Label Node as a child to a VideoNode). Is that prohibited for some reason?

golewis
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2018
01:04 PM
Re: Label Node Created in main.brs not rendering
I think you meant to put "video" instead of "VideoNode" (video)

golewis
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2018
01:32 PM
Re: Label Node Created in main.brs not rendering
Sorry for being vague. I've just tried this in my videoview.brs and it worked for me. (I'm using SGDEX)
If you're starting a channel from scratch I recommend the SGDEX Componentsand one of the SGDEX sample channels to get started.
video = m.top.createChild("Video")
video.id = "video"
video.width = "1280"
video.height = "720"
video.translation = "[0,0]"
video.enableUI = "false"
video.disableScreenSaver = m.top.disableScreenSaver
'Set m.video before setting theme as theme require m.video to be populated
m.video = video
if m.LastThemeAttributes <> Invalid then
SGDEX_SetTheme(m.LastThemeAttributes)
end if
video.ObserveFieldScoped("position", "OnPositionChanged")
video.ObserveFieldScoped("duration", "OnDurationChanged")
video.ObserveFieldScoped("state", "OnVideoStateChanged")
label = CreateObject("roSGNode", "Label")
label.text = "EPISODES AVAILABLE"
video.appendChild(label)
If you're starting a channel from scratch I recommend the SGDEX Componentsand one of the SGDEX sample channels to get started.

georgejecook
Streaming Star
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2018
12:59 PM
Re: Label Node Created in main.brs not rendering
you can't create a visual node before you initialize your scenegraph scene; unless you want all h e l l to break loose (crashing/hanging/cats loving dogs, end of the world scenarios).
George Cook
https://georgejecook.github.io/
https://linkedin.com/in/georgejecook/
Roku developers slack group (https://join.slack.com/t/rokudevelopers/shared_invite/zt-4vw7rg6v-NH46oY7hTktpRIBM_zGvwA) : georgejecook
Contact me on roku developer slack group, or via pm to discuss consultancy/work opportunities/rooibos unit testing framework
https://georgejecook.github.io/
https://linkedin.com/in/georgejecook/
Roku developers slack group (https://join.slack.com/t/rokudevelopers/shared_invite/zt-4vw7rg6v-NH46oY7hTktpRIBM_zGvwA) : georgejecook
Contact me on roku developer slack group, or via pm to discuss consultancy/work opportunities/rooibos unit testing framework