Kodi Community Forum
xbmcgui ListItem issue with list with static content - 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: xbmcgui ListItem issue with list with static content (/showthread.php?tid=114937)



xbmcgui ListItem issue with list with static content - cybersayo - 2011-11-18

I'm using List Container with static content as dropdown list for holding a list of options.
But, from within python, I cannot access list items?!
For dynamic populated list there is no problem, since I'm using this, but this is the first time that I need to access items of static content list.

For example...

...

Code:
<content>
              <item id="0">
                <label>$ADDON[script.tc 2069]</label>
                <onclick>-</onclick>
                <visible>true</visible>
                <property name="recure_type">once</property>
              </item>
              <item id="1">
                <label>$ADDON[script.tc 2065]</label>
                <onclick>-</onclick>
                <visible>true</visible>
                <property name="recure_type">daily</property>
              </item>

...

In python script I have method which selects item on this list based from the data from database.

Code:
def select_list_item_by_property(self,controlId,propertyName,propertyValue):
        listControl = self.getControl(controlId)
        for itemIndex in range(0,listControl.size()):
            listItem = listControl.getListItem(itemIndex)
            listItemPropertyValue = listItem.getProperty(propertyName)
            if propertyValue == listItemPropertyValue:
                listControl.selectItem(itemIndex)

But listControl.size() return 0 (zero) for this list.

Anybody have a clue??