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: 
bmceldowney
Visitor

Re: Is there a way to get the currently focused node?

"EnTerr" wrote:
And according to me, that timeout is a bug in the 7.6 beta which you are enrolled in - please report in the beta forum
(Try on 7.5 if you have one handy)

Hmm, that's curious. Well, thank you for your assistance, I'll give 7.5 a shot and post in the beta forum as you suggest.
0 Kudos
EnTerr
Roku Guru

Re: Is there a way to get the currently focused node?

"belltown" wrote:
In the first case, return Invalid. In the second case, I'd have to know more about those "cases in which setFocus() cannot restore the exact focused item".

What?
I think you and me were thinking different things - me, that there be a .getFocusedNode() method that returns currently focused node that can be stored in variable `lastFocusedNode` and then my concern is by the time one gets to use that stored info is unusable (node was detached).

In your case, you are imagining some magical function getLastFocusedNode() that would keep track of what, prior focused nodes? That's confusing to me, what is the definition of "last" - for example if i do .setFocus() on a node that is already focused, does "last" become the same node or does it do special check that it's the "last focused node that is not the current focused one".
0 Kudos
jeremie
Visitor

Re: Is there a way to get the currently focused node?

"bmceldowney" wrote:
From the console, 7.6.

According to the Roku docs, accessing the value of focusedChild will result in "script errors", so I'm assuming that's the problem. That's why I'm looking for any alternative methods to get the currently focused node.

It's not a bug, focusedChild can be used with observeField to know if the object himself lose or get the focus. So, the last child has himself as focusedChild.
I need the same loop like you, but we need to that to break the loop : 

if(child.focusedChild = invalid or child.isSameNode(child.focusedChild)) then

it's working for me
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.