Kodi Community Forum
hidden information in ControlList - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: hidden information in ControlList (/showthread.php?tid=2931)



- zilvershadow - 2004-04-21

i have a list of items:

item 1
item 2
item 3

but i want them labeled:

item 1 (http://www.address1.com)
item 2 (http://www.address2.com)
item 3 (http://www.address3.com)

(this is must not be visible in the screen)

when u select the item the address should appear in a dialog for example (test fase)

who could help me, please?

thanks


- madtw - 2004-04-21

create two lists: one to store the list labels and one to store the equivalent value. pass the label list to the list control when creating the gui. when the user selects a value you get an index returned to you. lookup the entry in the value list using the index returned to get the actual web address. for example:

Quote:labels = [ 'item 1', 'item 2', 'item 3' ]
values = ['http://www.address1.com', 'http://www.address2.com', 'http://www.address3.com' ]

dlg = xbmcgui.dialog()
selected = dlg.select('pick a value',labels)
print 'you picked %s' % values[selected]



- zilvershadow - 2004-04-21

i did it now with xbmcgui.controllist: getselectedposition() and it works.

thanks anyways

now i would like to sort the list in various ways just like in my music. i want a button that can do several actions to the list.

could you tell me how to do that?

(i'm learning python, it's all new to me but i like it very much and i'm writing a nice script with some very nice results.)

in a few days i'll show you my results.

thanks


- madtw - 2004-04-22

python list objects have a sort() method that takes a comparison function as an argument. you can do whatever custom comparison you need to do in that function. just have a look at the tutorials and reference information at http://python.org/doc for more information.