2009-01-08, 11:12
Hi guys,
I am trying to add new items to a fixedlist container, but it seems that the new items are not added at all.
I tried to follow the instructions in the pages:
http://wiki.xbmc.org/?title=Static_List_Content
http://wiki.xbmc.org/?title=Fixed_List_Container
http://wiki.xbmc.org/?title=WindowXML
What happens is that only the items of the list which have been added in the <content> node are displayed, but the new one is not added.
What am I doing wrong?
One more question: how can I specify the onclick action of a ListItem added via Python?
This is the python code:
And this is the content of Mypage.xml:
I am trying to add new items to a fixedlist container, but it seems that the new items are not added at all.
I tried to follow the instructions in the pages:
http://wiki.xbmc.org/?title=Static_List_Content
http://wiki.xbmc.org/?title=Fixed_List_Container
http://wiki.xbmc.org/?title=WindowXML
What happens is that only the items of the list which have been added in the <content> node are displayed, but the new one is not added.
What am I doing wrong?
One more question: how can I specify the onclick action of a ListItem added via Python?
This is the python code:
Code:
import xbmc
import xbmcgui
class MyDialog( xbmcgui.WindowXMLDialog ):
def __init__(self, *args, **kwargs ):
pass
def onInit (self ):
try:
self.getControl(9006).addItem( xbmcgui.\
ListItem("Added","Added Item"))
except Exception,e:
xbmc.log("Got exception in onInit %s" % e)
def onAction(self, action):
if (action.getId() == 10):
self.close()
pass
def onClick(self, controlID):
pass
def onFocus(self, controlID):
pass
if ( __name__== "__main__" ):
ui = MyDialog("Mypage.xml","")
ui.doModal()
del ui
And this is the content of Mypage.xml:
Code:
<window type="dialog" id="732">
<defaultcontrol>9006</defaultcontrol>
<allowoverlay>yes</allowoverlay>
<coordinates>
<system>1</system>
<posx>0</posx>
<posy>0</posy>
</coordinates>
<controls>
<control type="fixedlist" id="9006">
<description>My first list container</description>
<posx>80</posx>
<posy>60</posy>
<width>600</width>
<height>300</height>
<visible>true</visible>
<onup>2</onup>
<ondown>3</ondown>
<onleft>1</onleft>
<onright>1</onright>
<orientation>vertical</orientation>
<itemlayout width="250" height="29">
<control type="image">
<posx>5</posx>
<posy>3</posy>
<width>22</width>
<height>22</height>
<info>Listitem.Icon</info>
</control>
<control type="label">
<posx>30</posx>
<posy>3</posy>
<width>430</width>
<height>22</height>
<aligny>center</aligny>
<align>left</align>
<info>ListItem.label</info>
</control>
<control type="label">
<posx>475</posx>
<posy>3</posy>
<width>300</width>
<height>22</height>
<aligny>center</aligny>
<align>right</align>
<info>ListItem.label2</info>
</control>
</itemlayout>
<focusedlayout height="29" width="250">
<control type="image">
<posx>5</posx>
<posy>3</posy>
<width>500</width>
<height>22</height>
<info></info>
</control>
<control type="image">
<posx>5</posx>
<posy>3</posy>
<width>22</width>
<height>22</height>
<info>ListItem.Icon</info>
</control>
<control type="label">
<posx>30</posx>
<posy>3</posy>
<width>430</width>
<height>22</height>
<aligny>center</aligny>
<align>left</align>
<info>ListItem.Label</info>
<visible>true</visible>
</control>
<control type="label">
<posx>475</posx>
<posy>3</posy>
<width>300</width>
<height>22</height>
<aligny>center</aligny>
<align>right</align>
<info>ListItem.Label2</info>
</control>
</focusedlayout>
<content>
<item id="1">
<label>Item1</label>
<label2>Item1-2</label2>
<icon>home_ico.png</icon>
<thumb>no_ico.png</thumb>
<onclick>ActivateWindow(Home)</onclick>
<visible>true</visible>
</item>
<item id="2">
<label>Item2</label>
<label2>Item2-2</label2>
<icon>music_ico.png</icon>
<thumb>music_ico.png</thumb>
<onclick>ActivateWindow(MyMusicLibrary)</onclick>
<visible>true</visible>
</item>
<item id="3">
<label>Item3</label>
<label2>Item3-2</label2>
<icon>audio_ico.png</icon>
<thumb>audio_ico.png</thumb>
<onclick>ActivateWindow(MyMusicLibrary)</onclick>
<visible>true</visible>
</item>
</content>
</control>
</controls>
</window>