Solved List control and focus
#1
Hello,
I'm wasting a lot of time figuring out how to set the focus to a specific listItem inside a list control. Seems that the list control remember the last focused item, but I need to put the focus on a specific item which could be different from the old focused item. Is it possible somehow? I'm using an xml layout with 2 list control and a button. I need to put the focus to the desired listItem when I set the focus back to one of the lists.
Reply
#2
I'm creating an addon, I need it in the default.py script, probably inside the onFocus function of the window.
Reply
#3
code:
Control.SetFocus(id,position[,absolute])
Will make a list with the "id" specified in the command gain focus at "position" number in its list.
Set absolute to focus the first listitem of a container instead of the first visible listitem.
Reply
#4
Thanks...but I didn't succeed.
Also I refer to this page:
https://xbmc.github.io/docs.kodi.tv/mast...tions.html

But there, in the section:
Library built-in's

Everything is described in lower case...seems strange.
So now I'm confused. Is it:
.SetFocus
.setFocus
.setfocus

?
Also, with setFocus, it says that it is expected 1 param, not 2.
 self.setFocus(controlId, 2)
 TypeError: function takes at most 1 argument (2 given)
-->End of Python script error report<--

I'm trying some combination, but with no luck:
AttributeError: 'list' object has no attribute 'setFocus'
-->End of Python script error report<--
Reply
#5
Probably I solve it. I need to use:

xbmc.executebuiltin('Control.SetFocus(100, 1)')

So it is working now...
Reply
#6
Thread marked solved.
Reply

Logout Mark Read Team Forum Stats Members Help
List control and focus0