Kodi Community Forum
Window Properties manipulated as numericals values (increment / decrement etc) - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Skinning (https://forum.kodi.tv/forumdisplay.php?fid=12)
+--- Thread: Window Properties manipulated as numericals values (increment / decrement etc) (/showthread.php?tid=190541)



Window Properties manipulated as numericals values (increment / decrement etc) - powlo - 2014-03-27

Not sure if this has come up before. Googling didn't yield much.

I'd like to manipulate a property that is treated in script as a numerical.

Currently I call the script with an added fudge factor in sys.argv to increment or decrement the property.

This kind of feels a bit squiffy.

It would be better if I could just do it in the skin:

Code:
<onclick>SetProperty(XXX, Window.Property(XXX) + 1</onclick>

Is it possible?


RE: Window Properties manipulated as numericals values (increment / decrement etc) - ronie - 2014-03-27

nope.


RE: Window Properties manipulated as numericals values (increment / decrement etc) - powlo - 2014-03-28

Yeah I thought not. Script butchery it is.


RE: Window Properties manipulated as numericals values (increment / decrement etc) - powlo - 2014-03-28

Solution:

Code:
    <control type="button" id="2000">
        <onright>SetProperty(Button, $VAR[IncrementButton])</onright>
    </control>
.
.
.
    <variable name="IncrementButton">
        <value condition="StringCompare(Window.Property(Button),0)">1</value>
        <value condition="StringCompare(Window.Property(Button),1)">2</value>
        <value condition="StringCompare(Window.Property(Button),2)">3</value>
        <value condition="StringCompare(Window.Property(Button),3)">4</value>
        <value condition="StringCompare(Window.Property(Button),4)">4</value>
    </variable>

    <variable name="DecrementButton">
        <value condition="StringCompare(Window.Property(Button),0)">0</value>
        <value condition="StringCompare(Window.Property(Button),1)">0</value>
        <value condition="StringCompare(Window.Property(Button),2)">1</value>
        <value condition="StringCompare(Window.Property(Button),3)">2</value>
        <value condition="StringCompare(Window.Property(Button),4)">3</value>
    </variable>

Tested working in Frodo.

Only works if you know the range, and the range is reasonably finite.