Kodi Community Forum

Full Version: Cycling through grouplists
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Aaand stuck.

I have a group with 5 grouplists. And 2 buttons, 1 for up and 1 for down.
These buttons need to cycle through the visibility of those grouplists. Only one grouplist can be visible at a time.
And i can't use hiddenfocus. Or check against another list control. I tried something with toggling skin settings but they don't seem flexible enough.
I assume this is where variables come in? But i could not find an example like this.

Help is much appreciated.
Conditional OnUp and OnDown controls?
you could use

<onclick condition="Stringcompare(Window.Property(VisibleGrouplist),5) | IsEmpty(Window.Property(VisibleGrouplist))">SetProperty(VisibleGrouplist,1)</onclick>
<onclick condition="Stringcompare(Window.Property(VisibleGrouplist),1)">SetProperty(VisibleGrouplist,2)</onclick>
<onclick condition="Stringcompare(Window.Property(VisibleGrouplist),2)">SetProperty(VisibleGrouplist,3)</onclick>
...
for button 1 and the same in the other direction for button 2.

for grouplist visibilty conditions you then use stringcompare(Window.Property(VisibleGrouplist),1) etc.
On the group? Here is the group btw.
-edit- Phil65, ill have a look at it (hadn't seen your comment before i posted)


Code:
<control type="group">
            <posx>500</posx>    
            <posy>300</posy>
            
                
            <control type="button" id="1">
                <posx>180</posx>
                <posy>60</posy>        
                <description>up</description>
                <height>41</height>
                <width>54</width>
                
                <aspectratio>keep</aspectratio>
                <texturefocus>osdcircle/point.png</texturefocus>
                <texturenofocus>osdcircle/point.png</texturenofocus>
                
                <onclick>Dialog.Close(VideoOSD,true)</onclick>
                <onclick>fullscreen</onclick>
                <pulseonselect>yes</pulseonselect>
                <onup>87</onup>
                <ondown>4</ondown>
                <onleft>3</onleft>
                <onright>5</onright>
            </control>
            <control type="button" id="2">
                <posx>180</posx>
                <posy>300</posy>        
                <description>down</description>
                <height>41</height>
                <width>54</width>
                
                <aspectratio>keep</aspectratio>
                <texturefocus flipy="true">osdcircle/point.png</texturefocus>
                <texturenofocus flipy="true">osdcircle/point.png</texturenofocus>
                                
                <pulseonselect>yes</pulseonselect>
                <onleft>3</onleft>
                <onright>5</onright>
                <onup>4</onup>
            </control>
            
            <control type="grouplist" id="9001">
                <visible>true</visible>
                <posx>-150</posx>
                <posy>140</posy>
                <width>700</width>
                <height>300</height>
                <align>center</align>
                <orientation>horizontal</orientation>
                <itemgap>35</itemgap>
                <onup>1</onup>
                <ondown>2</ondown>
                <control type="button" id="3">
                    <posx>0</posx>
                    <posy>0</posy>        
                    <description>up</description>
                    <height>120</height>
                    <width>150</width>
                    <aspectratio>keep</aspectratio>
                    <texturefocus flipx="true">osdcircle/ff.png</texturefocus>
                    <texturenofocus flipx="true">osdcircle/ff.png</texturenofocus>
                    <pulseonselect>yes</pulseonselect>
                    <onclick>xbmc.playercontrol(rewind)</onclick>
                    <onright>4</onright>
                    
                </control>
                <control type="togglebutton" id="4">
                    <description>Play</description>
                    <posx>0</posx>
                    <posy>0</posy>
                    <height>120</height>
                    <width>150</width>
                    <texturefocus>osdcircle/play.png</texturefocus>
                    <texturenofocus>osdcircle/play.png</texturenofocus>
                    <usealttexture>Player.Playing</usealttexture>
                    <alttexturefocus>osdcircle/pause.png</alttexturefocus>
                    <alttexturenofocus>osdcircle/pause.png</alttexturenofocus>
                    <onclick>playercontrol(play)</onclick>
                    <pulseonselect>yes</pulseonselect>
                    <onleft>3</onleft>
                    <onright>5</onright>
                    
                </control>
                <control type="button" id="5">
                    <posx>0</posx>
                    <posy>0</posy>        
                    <description>Rewind</description>
                    <height>120</height>
                    <width>150</width>
                    <aspectratio>keep</aspectratio>
                    <texturefocus>osdcircle/ff.png</texturefocus>
                    <texturenofocus>osdcircle/ff.png</texturenofocus>
                    <pulseonselect>yes</pulseonselect>
                    <onclick>xbmc.playercontrol(forward)</onclick>
                    <onleft>4</onleft>
                    
                </control>
            </control>
            
            
            <control type="grouplist" id="9002">
                <visible>false</visible>
                <posx>-150</posx>
                <posy>140</posy>
                <width>700</width>
                <height>300</height>
                <align>center</align>
                <orientation>horizontal</orientation>
                <itemgap>35</itemgap>
                <onup>1</onup>
                <ondown>2</ondown>
                <control type="button" id="3">
                    <posx>0</posx>
                    <posy>0</posy>        
                    <description>up</description>
                    <height>120</height>
                    <width>150</width>
                    <aspectratio>keep</aspectratio>
                    <texturefocus flipx="true">osdcircle/skip.png</texturefocus>
                    <texturenofocus flipx="true">osdcircle/skip.png</texturenofocus>
                    <pulseonselect>yes</pulseonselect>
                    <onclick>xbmc.playercontrol(rewind)</onclick>
                    <onright>4</onright>
                    
                </control>
                
                <control type="button" id="4">
                    <posx>0</posx>
                    <posy>0</posy>        
                    <description>Rewind</description>
                    <height>120</height>
                    <width>150</width>
                    <aspectratio>keep</aspectratio>
                    <texturefocus>osdcircle/stop.png</texturefocus>
                    <texturenofocus>osdcircle/stop.png</texturenofocus>
                    <pulseonselect>yes</pulseonselect>
                    <onclick>xbmc.playercontrol(stop)</onclick>
                    <onleft>3</onleft>
                    <onright>5</onright>
                    
                </control>
                <control type="button" id="5">
                    <posx>0</posx>
                    <posy>0</posy>        
                    <description>Rewind</description>
                    <height>120</height>
                    <width>150</width>
                    <aspectratio>keep</aspectratio>
                    <texturefocus>osdcircle/skip.png</texturefocus>
                    <texturenofocus>osdcircle/skip.png</texturenofocus>
                    <pulseonselect>yes</pulseonselect>
                    <onclick>xbmc.playercontrol(forward)</onclick>
                    <onleft>4</onleft>
                    
                </control>
            </control>
            
            <control type="grouplist" id="9003">
                <visible><visible>Skin.HasSetting(ItemGroup3)</visible></visible>
                <posx>-150</posx>
                <posy>140</posy>
                <width>700</width>
                <height>300</height>
                <align>center</align>
                <orientation>horizontal</orientation>
                <itemgap>35</itemgap>
                <onup>1</onup>
                <ondown>2</ondown>
                <control type="button" id="3">
                    <posx>0</posx>
                    <posy>0</posy>        
                    <description>up</description>
                    <height>120</height>
                    <width>150</width>
                    <aspectratio>keep</aspectratio>
                    <texturefocus flipx="true">osdcircle/video.png</texturefocus>
                    <texturenofocus flipx="true">osdcircle/video.png</texturenofocus>
                    <pulseonselect>yes</pulseonselect>
                    <onclick>xbmc.playercontrol(rewind)</onclick>
                    <onright>4</onright>
                    
                </control>
                
                <control type="button" id="4">
                    <posx>0</posx>
                    <posy>0</posy>        
                    <description>Rewind</description>
                    <height>120</height>
                    <width>150</width>
                    <aspectratio>keep</aspectratio>
                    <texturefocus>osdcircle/getsub.png</texturefocus>
                    <texturenofocus>osdcircle/getsub.png</texturenofocus>
                    <pulseonselect>yes</pulseonselect>
                    <onclick>xbmc.playercontrol(stop)</onclick>
                    <onleft>3</onleft>
                    <onright>5</onright>
                    
                </control>
                <control type="button" id="5">
                    <posx>0</posx>
                    <posy>0</posy>        
                    <description>Rewind</description>
                    <height>120</height>
                    <width>150</width>
                    <aspectratio>keep</aspectratio>
                    <texturefocus>osdcircle/audio.png</texturefocus>
                    <texturenofocus>osdcircle/audio.png</texturenofocus>
                    <pulseonselect>yes</pulseonselect>
                    <onclick>xbmc.playercontrol(forward)</onclick>
                    <onleft>4</onleft>
                    
                </control>
            </control>
        </control>
Phil65, this does seem to be what i am looking for. Except it will not go to list nr 2 (9002).
I tried a couple of different sequences. But when i get it to go to 2 and 1 it won't go to 3.

Leaves me to guess it only uses the first onclick?
(2012-09-26, 20:09)MassIV Wrote: [ -> ]Phil65, this does seem to be what i am looking for. Except it will not go to list nr 2 (9002).
I tried a couple of different sequences. But when i get it to go to 2 and 1 it won't go to 3.

Leaves me to guess it only uses the first onclick?

uff, right, forgot that.
you have to adjust the sequence of the onclicks so that the property doesnt get toggled to 1 in line 1 and then directly to 2 in line 2 for example.
i´ll post an example in some minutes.
partly taken from xperience1080, with strings instead of properties.

Code:
<onclick condition="IsEmpty(Skin.String(CustomHomePanel2.Type))">Skin.SetString(CustomHomePanel2.Type,0)</onclick>
                            <onclick condition="stringcompare(Skin.String(CustomHomePanel2.Type),7)">Skin.SetString(CustomHomePanel2.Type,0)</onclick>
                            <onclick condition="stringcompare(Skin.String(CustomHomePanel2.Type),6)">Skin.SetString(CustomHomePanel2.Type,7)</onclick>
                            <onclick condition="stringcompare(Skin.String(CustomHomePanel2.Type),5)">Skin.SetString(CustomHomePanel2.Type,6)</onclick>
                            <onclick condition="stringcompare(Skin.String(CustomHomePanel2.Type),4)">Skin.SetString(CustomHomePanel2.Type,5)</onclick>
                            <onclick condition="stringcompare(Skin.String(CustomHomePanel2.Type),3)">Skin.SetString(CustomHomePanel2.Type,4)</onclick>
                            <onclick condition="stringcompare(Skin.String(CustomHomePanel2.Type),2)">Skin.SetString(CustomHomePanel2.Type,3)</onclick>
                            <onclick condition="stringcompare(Skin.String(CustomHomePanel2.Type),1)">Skin.SetString(CustomHomePanel2.Type,2)</onclick>
                            <onclick condition="stringcompare(Skin.String(CustomHomePanel2.Type),0)">Skin.SetString(CustomHomePanel2.Type,1)</onclick>
                            <onclick condition="stringcompare(Skin.String(CustomHomePanel2.Type),7)">Skin.SetString(CustomHomePanel2.Type,0)</onclick>
(2012-09-26, 20:22)phil65 Wrote: [ -> ]you have to adjust the sequence of the onclicks so that the property doesnt get toggled to 1 in line 1 and then directly to 2 in line 2 for example.
Your first example didn't do that either. Those 2 you posted two look pretty much the same to me.
This was my most recent try:
Code:
<onclick condition="IsEmpty(Window.Property(VisibleGrouplist)">SetProperty(VisibleGrouplist,9001)</onclick>
<onclick condition="Stringcompare(Window.Property(VisibleGrouplist),9003)">SetProperty(VisibleGrouplist,9001)</onclick>
<onclick condition="Stringcompare(Window.Property(VisibleGrouplist),9002)">SetProperty(VisibleGrouplist,9003)</onclick>
<onclick condition="Stringcompare(Window.Property(VisibleGrouplist),9001)">SetProperty(VisibleGrouplist,9002)</onclick>
that´s why i wrote "uff, right, forgot that." Wink
the second one definitely works, it´s tried and tested in xperience1080.
here´s the complete code snippet with both buttons directly from the skin source (includes_settings.xml). it definitely works. (you have to add the initial onempty stuff)
http://pastebin.com/mhLH4duW
Got it! Thnx so much Phil65!

Dear future self,
This is how it works:
Code:
<onload condition="IsEmpty(Window.Property(VisibleGrouplist)">SetProperty(VisibleGrouplist,9001)</onload>


<onclick condition="Stringcompare(Window.Property(VisibleGrouplist),0)">SetProperty(VisibleGrouplist,9003)</onclick>
<onclick condition="Stringcompare(Window.Property(VisibleGrouplist),9001)">SetProperty(VisibleGrouplist,0)</onclick>
<onclick condition="Stringcompare(Window.Property(VisibleGrouplist),9003)">SetProperty(VisibleGrouplist,9001)</onclick>
<onclick condition="Stringcompare(Window.Property(VisibleGrouplist),9002)">SetProperty(VisibleGrouplist,9003)</onclick>
<onclick condition="Stringcompare(Window.Property(VisibleGrouplist),9001)">SetProperty(VisibleGrouplist,9002)</onclick>