Python add-on for Custom GUI using WindowXML - how to get onFocusedItem
#1
In a python add-on using WindowXML for custom GUI, I'm trying to access focused item (not selected) in a List control.

class GUI(xbmcgui.WindowXML):


   def onFocus(self, controlID):
       # This method gets triggered when my GUI focus (i.e. no Enter/OK pressed yet) moves to a particular control.
       curPanel = self.getControl(controlID).  # gets me the Panel that has focus.

      # how do I get the item that currently is focussed ?

     # curPanel.getSelectedItem() will return a value only when I hit OK on focused item.

I think the information I'm looking for (which item is focused) is available to the GUI because if we move focus to another control (not item in same control) and come back to this Panel, the last focused item on the Panel will again get focus. So somewhere in the GUI, it knows which item was focused.

Thanks in advance.
Reply
#2
try if this works for you:
position = curPanel.getSelectedPosition()
curItem = curPanel.getListItem(position)
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
Thanks Ronie.

I tried and it didn't work. I get the same error in logs when I try to reference any property of the curItem.

​​​​It seems like there is no way to access the focused item from Python Addons.
Reply
 
Thread Rating:
  • 0 Vote(s) - 0 Average



Logout Mark Read Team Forum Stats Members Help
Python add-on for Custom GUI using WindowXML - how to get onFocusedItem00