View Full Version : hidden information in ControlList
zilvershadow
2004-04-21, 01:43
i have a list of items:
item 1
item 2
item 3
but i want them labeled:
item 1 (www.address1.com)
item 2 (www.address2.com)
item 3 (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
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:
labels = [ 'item 1', 'item 2', 'item 3' ]
values = ['www.address1.com', 'www.address2.com', 'www.address3.com' ]
dlg = xbmcgui.dialog()
selected = dlg.select('pick a value',labels)
print 'you picked %s' % values[selected]
zilvershadow
2004-04-21, 14:42
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
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.