Getting the current selection
#25
(2016-09-19, 12:23)woodside Wrote: Not sure if these are what you're looking for...

Code:
xbmc.getInfoLabel('System.CurrentControl')
Works for me to get to get the selected item.

Unfortunately, this will give the currently focused list, but not the ListItem...

Quote:
Code:
getSelectedItem(...)
getSelectedItem() --Returns the selected item as aListItem object.

*Note, Same as getSelectedPosition() , but instead of an integer aListItem object
is returned. Returns None for empty lists.
See windowexample.py on how to use this.

example:
    - item = cList.getSelectedItem()
To get as an object.

And this whole thread is about how this method doesn't work (still Rofl) for controls that were created in XML.

For my usage, that doesn't work. I am filling a list control in an XML dialog with items via a <content> tag, but am unable to retrieve the actual ListItems through any means, as far as I can tell.

I can use JSON-RPC to get various information (basically the same as the standard InfoLabels) for all the files in a directory, or I can access the InfoLabels the way that I am now (Container(id).ListItem(position).xxxxx). Unfortunately, neither of these methods gives the ability to get the original ListItem.

To add to the matter, it appears that most of the API for ControlList (and probably other controls) is broken when dealing with XML windows. I'm unable to use really any of the methods related to items in a ControlList, like size() or getListItem(index), the latter of which really seemed like the ticket here.

Honestly, it's not really surprising that this hasn't ever been fully addressed (or addressed at all, maybe?), but it certainly is disappointing Sad
Reply


Messages In This Thread
Getting the current selection - by jhsrennie - 2012-07-02, 16:53
RE: Getting the current selection - by pieh - 2012-07-03, 10:30
RE: Getting the current selection - by ronie - 2012-09-21, 20:17
RE: Getting the current selection - by ronie - 2012-09-21, 23:19
RE: Getting the current selection - by Popeye - 2012-11-27, 23:10
RE: Getting the current selection - by belese - 2013-10-10, 16:04
RE: Getting the current selection - by tim619 - 2015-11-07, 02:18
RE: Getting the current selection - by Torben - 2016-04-02, 15:14
RE: Getting the current selection - by drinfernoo - 2020-05-25, 05:36


Logout Mark Read Team Forum Stats Members Help
Getting the current selection0
This forum uses Lukasz Tkacz MyBB addons.