Kodi Community Forum

Full Version: holding onto listitem info
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Working on a list of music, in this case specifically albums if it matters.   I have several buttons that I'd like to take an actions based on the focused item.   The problem is, I lose access to the listitems when the focus changes.   I've tried capturing the listitem into a string as the list is navigated using but no success. 
xml:
<onup>Skin.SetString(foo,$INFO[ListItem.DBID])</onup>
<ondown>Skin.SetString(foo,$INFO[ListItem.DBID])</ondown>
Also tried capturing the listitem using <onunfocus> as a trigger, also without success.
xml:
<onunfocus>Skin.Setstring(foo,$INFO[ListItem.DBID])</onunfocus>

One workaround was to use a quick script that ties the action directly to a keystroke since that can be done without losing focus on the list.   But it would be better to have on screen buttons.

Any help would be appreciated.
you need to put the focus back to the listitem before taking the action.
to do that, you can add multiple `<onclick>` definitions to your button. so something like this might work:

<onclick>SetFocus(id of container)</onclick>
<onclick>YourAction</onclick>
<onclick>SetFocus(id of button)</onclick>
Thanks. For all the times I’ve already used multiple actions for a button, I never would have thought to flip the focus back to another control.