Forum Discussion
5 Replies
- norcaljohnnyRoku GuruYou can use many methods but I normally use a variable something like this so I can increment elsewhere in the component or as text..
m.currentItem = m.postergrid.itemFocused
m.myLabel.text = m.currentItem
This is assuming I have a topNode named m.postergrid - ajaypaudelVisitor
"norcaljohnny" wrote:
You can use many methods but I normally use a variable something like this so I can increment elsewhere in the component or as text..
m.currentItem = m.postergrid.itemFocused
m.myLabel.text = m.currentItem
This is assuming I have a topNode named m.postergrid
Now the problem is it shows focused on different item and when we print then the value is different and when we click up button and gives invalid value and when clicking down after certain value again it gives invalid value, how can we solve that issue? - speechlesRoku Guruhandled = false
if m.labellist.isInFocusChain() and press
if key = "up"
if m.labellist.itemFocused = 0
m.labelist.jumpToItem = m.labellist.content.getChildCount()-1
m.labellist.animateToItem = m.labellist.content.getChildCount()-1
else
m.labellist.jumpToItem = m.itemFocused - 1
end if
handled = true
else if key = "down"
if m.labellist.itemFocused = m.labellist.content.getChildCount()-1
m.labellist.jumpToItem = 0
m.labellist.animateToItem = 0
else
m.labellist.jumpToItem = m.itemFocused + 1
end if
handled = true
else if key = "OK"
handleLabellistOKpress(m.labellist.itemSelected)
handled = true
end if
end if
return handled
( the reason for both jumpToItem and animateToItem is because I have no idea how large the viewport is you give your labellist. jumpToItem only jumps to the first/last item visible in your viewport. animateToItem will move to the first/last of your labellist and scroll to it )
To control the up/down and have it wrap you would do something like the above.
In a labellist itemFocused for focused item. itemSelected for item chosen. Are you mixing these up? - ajaypaudelVisitor
"speechles" wrote:
handled = false
if m.labellist.isInFocusChain() and press
if key = "up"
if m.labellist.itemFocused = 0
m.labelist.jumpToItem = m.labellist.content.getChildCount()-1
m.labellist.animateToItem = m.labellist.content.getChildCount()-1
else
m.labellist.jumpToItem = m.itemFocused - 1
end if
handled = true
else if key = "down"
if m.labellist.itemFocused = m.labellist.content.getChildCount()-1
m.labellist.jumpToItem = 0
m.labellist.animateToItem = 0
else
m.labellist.jumpToItem = m.itemFocused + 1
end if
handled = true
else if key = "OK"
handleLabellistOKpress(m.labellist.itemSelected)
handled = true
end if
end if
return handled
( the reason for both jumpToItem and animateToItem is because I have no idea how large the viewport is you give your labellist. jumpToItem only jumps to the first/last item visible in your viewport. animateToItem will move to the first/last of your labellist and scroll to it )
To control the up/down and have it wrap you would do something like the above.
In a labellist itemFocused for focused item. itemSelected for item chosen. Are you mixing these up?
Let me explain you,
we have all the channel name list and
m.list.ObserveField("itemFocused", "onItemFocused")
m.list.ObserveField("itemSelected", "OnItemSelected")
for on focus and on selected and on onItemFocused function we have done
row = m.list.currFocusRow
col= m.list.currFocusSection
section = m.list.content.getChild(col)
channel=section.getChild(row)
here it gives the correct data upto the data showing on the monitor screen and when i click up and below the monitor screen it gives wrong data or invalid - speechlesRoku GuruIn your onKeyEvent when you navigate around make sure to check you don't fall out of bounds. Go by getChildCount()-1 and use that as the max for each col/row. Then use zero to tell the top. Don't let yourself go out of bounds or if you do then wrap to bottom and vice versa. Look above to the labellist code I gave above to see how I wrap there top/bottom and do the same. You can also do the same and wrap left/right right/left through the columns edges. What does your onKeyEvent look like?