Give ids to controllist items
#1
hi there,
got two problems:

1.) i've got a controllist with some items in it.
now i want to give an id to every item in the list. (i need this id for later usage: i need to identify the selected item, but i can't identify it by its name...).
how do i do something like that?

2.) when the controllist has no items added and i verify with the a button this not-existing item, my box f*cks up after the following line:
Quote:item = self.list.getselecteditem()
how do i prevent the box from freezing?

i hope you can help me

thanks
Reply
#2
1) i usually have an array that mirrors the list items that are being displayed. so then if someone selects the 4th entry, grab the 4th element in the array and do whatever you want with it. the python array can have any kind of class you want stored in it.

2) there is a bug in the c++ code - it needs to handle the situation where there is nothing in the list. use getselectedposition() instead. note: it currently returns 0 when no items are in the list... 0 is a valid index though, so you will need to check your array to see if you actually have anything in it.

edit i have submitted xbmc patch 1182692 to fix both getselectedposition() so that it returns -1 when the list is empty and getselecteditem() so that it returns none when the list is empty (and doesn't lock up xbmc).
Reply
#3
thank you very much Wink
when will this built in to the cvs?
Reply
#4
jmarshall has pulled it into cvs already...
Reply

Logout Mark Read Team Forum Stats Members Help
Give ids to controllist items0