Kodi Community Forum
Dynamic List Content onclick - 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: Dynamic List Content onclick (/showthread.php?tid=194415)



Dynamic List Content onclick - null_pointer - 2014-05-08

Hi,

I have some dynamic content being feed back to a skin to populate a list, see bottom of this page "Plugin provided content"

http://wiki.xbmc.org/index.php?title=Static_List_Content

The problem I am having is the onclick of the items populated can not be set in the skin, it looks like the onclick is always being set by the URL of the dynamically generated list items.

I want to have onclick set in the definition of the itemlayout, example

PHP Code:
                <control type="panel" id="50">
                    <
left>380</left>
                    <
top>520</top>
                    <
width>860</width>
                    <
height>120</height>
                    <
onleft>9000</onleft>
                    <
onright>61</onright>
                    <
onup>61</onup>
                    <
ondown>9000</ondown>
                    <
viewtype label="">list</viewtype>
                    <
pagecontrol>61</pagecontrol>
                    <
scrolltime>200</scrolltime>
                    <
orientation>vertical</orientation>
                    <
itemlayout height="40" width="430">
                        <
control type="label">
                            <
left>10</left>
                            <
top>0</top>
                            <
width>410</width>
                            <
height>40</height>
                            <
font>font12</font>
                            <
align>left</align>
                            <
aligny>center</aligny>
                            <
selectedcolor>blue</selectedcolor>
                            <
info>ListItem.Label</info>
                        </
control>
                    </
itemlayout>
                    <
focusedlayout height="40" width="430">
                        <
control type="label">
                            <
left>10</left>
                            <
top>0</top>
                            <
width>410</width>
                            <
height>40</height>
                            <
font>font12</font>
                            <
align>left</align>
                            <
aligny>center</aligny>
                            <
selectedcolor>white</selectedcolor>
                            <
info>ListItem.Label</info>
                            <
onclick>XBMC.RunScript(plugin.video.xbmb3c,PersonInfo,mode=15&name=Jack+Black)</onclick>
                        </
control>
                    </
focusedlayout>
                     <
content target="video">$INFO[ListItem.Property(CastPluginLink)]</content>
                </
control

the onclick XBMC.RunScript is being ignored and only the ListItem url that was passed into the dynamic items is used when you click on an item.

if I put static items in like this and remove the onclick from the above label

<content>
<item id="1">
<label>My First Item</label>
<onclick>XBMC.RunScript(plugin.video.xbmb3c,PersonInfo,mode=15&name=Jack+Black)</onclick>
<visible>true</visible>
</item>
</content>

it works fine

simple question is, can I override the onclick of dynamic data or can I pass in a url that runs a script?


RE: Dynamic List Content onclick - jmarshall - 2014-05-08

Sure - just set the path in your plugin. You can also set various properties on the items such as node:target_url and the like, which allows them to have a different click action to their path (so the skin can use ListItem.Path to do stuff, but on click it'll execute something else). The details are in the thread on dynamic content on the forums here - see the skin dev section.


RE: Dynamic List Content onclick - null_pointer - 2014-05-09

cool thank you, I will have a read and see what I can work out.