Your Digital Media Has Never Looked So Good

 
belltown
Posts: 1465
Joined: Thu Dec 09, 2010 1:43 pm
Contact:

Re: Back key not closing RSG Dialogs

Tue Apr 04, 2017 11:47 pm

EnTerr wrote:
Because not every component has a .dialog property.
Only Scene nodes have that property.
And since saw elsewhere we should use only one and only scene, that means there is only one such node per RSG.

I get it now. I was confusing components with Scenes. Yes, there's only one Scene generally, so that's where you need to set the dialog.

I hadn't come across this issue myself because most of my dialogs are "custom" components, not real Dialog components, but they behave as modal dialogs. I show/hide them instead of setting scene.dialog. The only time I use actual Dialog components are in my main Scene, so m.top.dialog works.

So yes, EnTerr's solution should get the Scene m.top, or just pass it in as a component interface field -- or, since there's only one Scene, set m.global.scene = m.top
https://github.com/belltown/
 
User avatar
RokuNB
Posts: 465
Joined: Fri Mar 31, 2017 2:22 pm

Re: Back key not closing RSG Dialogs

Wed Apr 05, 2017 7:29 pm

or you can do
            scene = invalid
            for each nod in m.top.getRoots():
                if nod.isSubType("scene") then scene = nod: exit for
            next

This should work, if there is one and only one scene (which seems like a sane assumption)
 
belltown
Posts: 1465
Joined: Thu Dec 09, 2010 1:43 pm
Contact:

Re: Back key not closing RSG Dialogs

Wed Apr 05, 2017 7:47 pm

RokuNB wrote:
or you can do
m.top.getRoots()


According to the docs, the note above getRoots() states: The following methods can be called on any subject node and return the same global results. They can be used in a development channel for debugging purposes, but should not be used in a production channel. and then it goes on to say: Any calls to getAll(), getRoots(), getRootsMeta() and getAllMeta() should be removed from your production channels.
https://github.com/belltown/
 
User avatar
RokuNB
Posts: 465
Joined: Fri Mar 31, 2017 2:22 pm

Re: Back key not closing RSG Dialogs

Sat Apr 08, 2017 10:39 pm

belltown wrote:
According to the docs, the note above getRoots() states: The following methods can be called on any subject node and return the same global results. They can be used in a development channel for debugging purposes, but should not be used in a production channel. and then it goes on to say: Any calls to getAll(), getRoots(), getRootsMeta() and getAllMeta() should be removed from your production channels.

The wisdom behind of that statement is not immediately apparent to me. It is possible that some of these functions are grossly inefficient (but ok for debug). It might be prudent then to use the previous idea of getParent() to the root.
 
belltown
Posts: 1465
Joined: Thu Dec 09, 2010 1:43 pm
Contact:

Re: Back key not closing RSG Dialogs

Sat Apr 08, 2017 10:53 pm

RokuNB wrote:
belltown wrote:
According to the docs, the note above getRoots() states: The following methods can be called on any subject node and return the same global results. They can be used in a development channel for debugging purposes, but should not be used in a production channel. and then it goes on to say: Any calls to getAll(), getRoots(), getRootsMeta() and getAllMeta() should be removed from your production channels.

The wisdom behind of that statement is not immediately apparent to me. It is possible that some of these functions are grossly inefficient (but ok for debug). It might be prudent then to use the previous idea of getParent() to the root.

I'd be curious to know the wisdom as well. It did refer to these features as diagnostic tools in the Developer Blog post that announced their availability: https://blog.roku.com/developer/2016/06/21/roku-os-7-2-dev-highlights/. You wouldn't normally use diagnostic (debugging?) tools in production code, but it doesn't explain why these particular tools shouldn't be used in production.
https://github.com/belltown/
 
User avatar
RokuNB
Posts: 465
Joined: Fri Mar 31, 2017 2:22 pm

Re: Back key not closing RSG Dialogs

Mon Apr 17, 2017 7:29 pm

belltown wrote:
I'd be curious to know the wisdom as well. It did refer to these features as diagnostic tools in the Developer Blog post that announced their availability: https://blog.roku.com/developer/2016/06/21/roku-os-7-2-dev-highlights/. You wouldn't normally use diagnostic (debugging?) tools in production code, but it doesn't explain why these particular tools shouldn't be used in production.

I got some clarification and that is that their implementations indeed were not intended for production use, while work well while debugging. E.g. say getRoots() might be enumerating thousands of nodes (all nodes) to filter by .getParent() = invalid criteria. That O(n) is fine when troubleshooting but misleading and bad for production. (It may or not be doing that - i haven't looked at the source - but you get the gist)

Who is online

Users browsing this forum: No registered users and 9 guests