Using conditions in <timeperimage> ?
#1
Is it possible to use conditions (or perhaps $VAR[]) in <timeperimage> ?

e.g. none of this works

Code:
<timeperimage condition="Skin.HasSetting(somesetting)">30000</timeperimage>

or

Code:
<timeperimage>$INFO[Skin.String(someskinstring)]</timeperimage>

or
Code:
<variable name="timeperimagevalue">
   <value condition="Skin.HasSetting(somesetting1)">30000</value>
   <value condition="Skin.HasSetting(somesetting2)">60000</value>
</variable>

...

<timeperimage>$VAR[timeperimagevalue]</timeperimage>

Only way I was able to do this was to have multiple multiimage controls and then set visibility using <visible> conditions. Is there a better way ?
PHP Code:
<control type="multiimage">
    [...]
    <
timeperimage>15000</timeperimage>
    <
visible>stringcompare(Skin.String(BackdropMultiTime),15000)</visible>
</
control

<
control type="multiimage">
    [...]
    <
timeperimage>30000</timeperimage>
    <
visible>stringcompare(Skin.String(BackdropMultiTime),30000)</visible>
</
control

<
control type="multiimage">
    [...]
    <
timeperimage>60000</timeperimage>
    <
visible>stringcompare(Skin.String(BackdropMultiTime),60000)</visible>
</
control
Reply
#2
Conditional includes if they don't need to be changed when a window is loaded.
Reply
#3
(2013-01-13, 13:20)Hitcher Wrote: Conditional includes if they don't need to be changed when a window is loaded.

Hi Hitcher, sorry for being daft but I'm new at this so could you please explain some more ?
Reply
#4
PHP Code:
<include name="Time1">
    <
timeperimage>30000</timeperimage>
</include>

<include 
name="Time2">
    <
timeperimage>60000</timeperimage>
</include>

<
control type="multiimage">
    [...]
    <include 
condition="Skin.HasSetting(somesetting1)">Time1</include>
    <include 
condition="Skin.HasSetting(somesetting2)">Time2</include>
</
control
Image
Reply
#5
(2013-01-13, 15:00)`Black Wrote:
PHP Code:
<include name="Time1">
    <
timeperimage>30000</timeperimage>
</include>

<include 
name="Time2">
    <
timeperimage>60000</timeperimage>
</include>

<
control type="multiimage">
    [...]
    <include 
condition="Skin.HasSetting(somesetting1)">Time1</include>
    <include 
condition="Skin.HasSetting(somesetting2)">Time2</include>
</
control
Working great, tnx Black Smile

one more thing if I may ask, how do you set default value for your fake spin control ?

e.g.
I added this to set <timeperimage> but first time skin is loaded value is blank
PHP Code:
<control type="group" id="5004">
                    <
description>Fake spin control</description>
                    <
visible>!IsEmpty(Skin.String(GlobalBackdropMulti)) | !IsEmpty(Skin.String(HomeMoviesMultiImage)) | !IsEmpty(Skin.String(HomeTVShowsMultiImage)) | !IsEmpty(Skin.String(HomeMusicMultiImage)) | !IsEmpty(Skin.String(HomeProgramsMultiImage)) | !IsEmpty(Skin.String(HomeWeatherMultiImage)) | !IsEmpty(Skin.String(HomeSettingsMultiImage))</visible>
                    <
width>1210</width>
                    <
height>77</height>
                    <
control type="image">
                        <
posx>0</posx>
                        <
posy>0</posy>
                        <
width>1210</width>
                        <
height>77</height>
                        <
texture border="90,3,90,3">views/list/other/separator.png</texture>
                        <
visible>!ControlGroup(5004).HasFocus</visible>
                    </
control>
                    <
control type="image">
                        <
posx>0</posx>
                        <
posy>0</posy>
                        <
width>1210</width>
                        <
height>77</height>
                        <
texture border="150,3,150,3">windows/settings/images/right-focus.png</texture>
                        <
aspectratio>stretch</aspectratio>
                        <
visible>ControlGroup(5004).HasFocus</visible>
                    </
control>
                    <
control type="button" id="50041">
                        <
posx>1104</posx>
                        <
posy>8</posy>
                        <
width>43</width>
                        <
height>60</height>
                        <
onleft>50042</onleft>
                        <
onright>50042</onright>
                        <
onup>5010</onup>
                        <
ondown>1001</ondown>
                        <
texturefocus>buttons/spinctrl/arrow-down-fo.png</texturefocus>
                        <
texturenofocus>buttons/spinctrl/arrow-down-nf.png</texturenofocus>
                        <
onfocus condition="!IsEmpty(Window(Home).Property(ReloadSkin))">ReloadSkin</onfocus>
                        <
onfocus condition="!IsEmpty(Window(Home).Property(ReloadSkin))">ClearProperty(ReloadSkin,Home)</onfocus>
                        <
onclick condition="IsEmpty(Skin.String(BackdropMultiTime))">Skin.SetString(BackdropMultiTime,15sec)</onclick>
                        <
onclick condition="stringcompare(Skin.String(BackdropMultiTime),15sec)">Skin.SetString(BackdropMultiTime,30sec)</onclick>
                        <
onclick condition="stringcompare(Skin.String(BackdropMultiTime),1min)">Skin.SetString(BackdropMultiTime,15sec)</onclick>
                        <
onclick condition="stringcompare(Skin.String(BackdropMultiTime),30sec)">Skin.SetString(BackdropMultiTime,1min)</onclick>
                        <
onclick condition="stringcompare(Skin.String(BackdropMultiTime),15sec)">Skin.SetString(BackdropMultiTime,30sec)</onclick>
                    </
control>
                    <
control type="button" id="50042">
                        <
posx>1147</posx>
                        <
posy>8</posy>
                        <
width>43</width>
                        <
height>60</height>
                        <
onleft>50041</onleft>
                        <
onright>50041</onright>
                        <
onup>5010</onup>
                        <
ondown>1001</ondown>
                        <
texturefocus>buttons/spinctrl/arrow-up-fo.png</texturefocus>
                        <
texturenofocus>buttons/spinctrl/arrow-up-nf.png</texturenofocus>
                        <
onfocus condition="!IsEmpty(Window(Home).Property(ReloadSkin))">ReloadSkin</onfocus>
                        <
onfocus condition="!IsEmpty(Window(Home).Property(ReloadSkin))">ClearProperty(ReloadSkin,Home)</onfocus>
                        <
onclick condition="IsEmpty(Skin.String(BackdropMultiTime))">Skin.SetString(BackdropsTime,15sec)</onclick>
                        <
onclick condition="stringcompare(Skin.String(BackdropMultiTime),1min)">Skin.SetString(BackdropMultiTime,30sec)</onclick>
                        <
onclick condition="stringcompare(Skin.String(BackdropMultiTime),15sec)">Skin.SetString(BackdropMultiTime,1min)</onclick>
                        <
onclick condition="stringcompare(Skin.String(BackdropMultiTime),30sec)">Skin.SetString(BackdropMultiTime,15sec)</onclick>
                        <
onclick condition="stringcompare(Skin.String(BackdropMultiTime),1min)">Skin.SetString(BackdropMultiTime,30sec)</onclick>
                    </
control>
                    <
control type="button">
                        <
posx>0</posx>
                        <
posy>0</posy>
                        <
width>1120</width>
                        <
height>77</height>
                        <
align>left</align>
                        <
aligny>center</aligny>
                        <
textoffsetx>35</textoffsetx>
                        <
font>Font-Condensed-S30-B</font>
                        <
textcolor>96FFFFFF</textcolor>
                        <
label>Set multi image time per image</label>
                        <
label2>$INFO[Skin.String(BackdropMultiTime)]</label2>
                        <
visible>!ControlGroup(5004).HasFocus</visible>
                    </
control>
                    <
control type="button">
                        <
posx>0</posx>
                        <
posy>0</posy>
                        <
width>1120</width>
                        <
height>77</height>
                        <
align>left</align>
                        <
aligny>center</aligny>
                        <
textoffsetx>35</textoffsetx>
                        <
font>Font-Condensed-S30-B</font>
                        <
textcolor>white</textcolor>
                        <
label>Set multi image time per image</label>
                        <
label2>$INFO[Skin.String(BackdropMultiTime)]</label2>
                        <
visible>ControlGroup(5004).HasFocus</visible>
                    </
control>
                </
control>
            </
control

Reply
#6
You have to load it with <onload>. If the setting is empty, set default value.
Image
Reply
#7
(2013-01-13, 18:34)`Black Wrote: You have to load it with <onload>. If the setting is empty, set default value.

ahhh great tnx again Smile
Reply

Logout Mark Read Team Forum Stats Members Help
Using conditions in <timeperimage> ?0