Kodi Community Forum

Full Version: activate specific view for specific content with <onclick>
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

i have defined this

Code:
<control type="button" id="21">
                    <include>WindowMenuButton</include>
                    <label>Albums</label>
                    <onclick>Container.SetViewMode(icon)</onclick>
                    <onclick>ReplaceWindow(MusicLibrary,Albums,)</onclick>
                </control>

in MyMusicNav.xml in a list and this

Code:
<includes>
<include name="Viewtype_Music_Grid">    
        <control type="panel" id="53">
...
<viewtype label="Grid">icon</viewtype>
<visible>!Container.Content(artists) | Container.Content(albums) | !Container.Content(genres)</visible>
...
</include>
</includes>
in an extra view.xml, but i couldn't manage the button to work.
what am i missing? why isn't it working?
have also tried to use "Grid" and "panel" in Containe.SetViewMode() but that also doesn't work...

thanks for your help
You have specify the id of the container, not the viewtype name. Smile So it would be Container.SetViewMode(53) in your case. Plus your visible condition makes no sense, should be

Code:
<visible>Container.Content(albums)</visible>

or
Code:
<visible>!Container.Content(artists) + !Container.Content(genres)</visible>

or something else, don't know what you want to have exactly.
No stupid mistake

thank you for the quick help... and yes the <visible> tags make no sense - caused by copy and paste and lot of playing around just to learn...Laugh