Change of background when button focused
#1
I want the background to change when a button on the home screen is focused.

I know how to do this for the buttons on the main menu, but I haven't been able to figure out how to do this for a separate button.

Please find my home.xml code below.
Code:
        <control type="multiimage">
            <posx>0</posx>
            <posy>0</posy>
            <width>1280</width>
            <height>720</height>
            <imagepath background="true">$INFO[Container(9000).ListItem.Icon]</imagepath>
            <timeperimage>8000</timeperimage>
            <randomize>true</randomize>
            <fadetime>1000</fadetime>
        </control>
        <control type="multiimage">
            <posx>0</posx>
            <posy>0</posy>
            <width>1280</width>
            <height>720</height>
            <imagepath background="true">$INFO[Container(10).ListItem.Icon]</imagepath>
            <timeperimage>8000</timeperimage>
            <randomize>true</randomize>
            <fadetime>1000</fadetime>
        </control>

And then I have:
Code:
        <control type="group" id="10">
            <posx>0</posx>
            <posy>42r</posy>
            <include>Window_OpenClose_Animation</include>
            <control type="button" id="21">
                <description>Settings button</description>
                <posx>12</posx>
                <posy>0</posy>
                <width>35</width>
                <height>35</height>
                <label>1036</label>
                <onclick>ActivateWindow(Settings)</onclick>
                <texturenofocus border="5">floor_button.png</texturenofocus>
                <icon>C:\Program Files (x86)\XBMC\addons\skin.confluence\backgrounds\settings.jpg</icon>
                <onleft>9000</onleft>
                <onright>9000</onright>
                <onup>9000</onup>
                <ondown>9000</ondown>
            </control>
            <control type="image">
                <description>Settings Icon</description>
                <posx>12</posx>
                <posy>0</posy>
                <width>35</width>
                <height>35</height>
                <aspectratio>keep</aspectratio>
                <texture>icon_system.png</texture>
            </control>
        </control>

What do I do wrong?

I very much enjoy skin "modding" but I'm only a beginner so pls bear with me Smile

Your help is much appreciated!
Reply
#2
#1 A group is not a container. Container(10).ListItem doesn't work for groups
#2 A button control has no icon
#3 Why do you use a multiimage control for a single image? I would do it like this:

PHP Code:
# Add this to Includes.xml
<variable name="HomeBackgroundVar">
    <
value condition="Control.HasFocus(21)">special://skin/backgrounds/settings.jpg</value> # always try to use special:// instead of absolute paths
    
<value>$INFO[Container(9000).ListItem.Icon]</value>
</
variable>

<
control type="image">
    [...]
    <
texture background="true">$VAR[HomeBackgroundVar]</texture>
    <
fadetime>1000</fadetime>
</
control
Image
Reply
#3
Thank you very much for your time!

I added below code to includes.xml
Code:
<variable name="HomeBackgroundVar">
    <value condition="Control.HasFocus(21)">special://skin/backgrounds/settings.jpg</value>
    <value>$INFO[Container(9000).ListItem.Icon]</value>
</variable>

And now my home.xml looks as follows
Code:
<control type="group" id="10">
            <posx>0</posx>
            <posy>42r</posy>
            <include>Window_OpenClose_Animation</include>
            <control type="button" id="21">
                <description>Settings button</description>
                <posx>12</posx>
                <posy>0</posy>
                <width>35</width>
                <height>35</height>
                <label>1036</label>
                <font>-</font>
                <aligny>-</aligny>
                <onclick>ActivateWindow(Settings)</onclick>
                <texturefocus border="5">floor_buttonFO.png</texturefocus>
                <texturenofocus border="5">floor_button.png</texturenofocus>
                <onleft>9000</onleft>
                <onright>9000</onright>
                <onup>9000</onup>
                <ondown>9000</ondown>
            </control>
            <control type="image">
                <description>Settings Icon</description>
                <posx>12</posx>
                <posy>0</posy>
                <width>35</width>
                <height>35</height>
                <aspectratio>keep</aspectratio>
                <texture>icon_system.png</texture>
                <texture background="true">$VAR[HomeBackgroundVar]</texture>
                <fadetime>1000</fadetime>
            </control>
        </control>

Unfortunately nothing happens when I select the button. Can you please advise what I forgot?
Reply
#4
You have 2 textures in the image, so <texture>icon_system.png</texture> is preferred over the texture below. Also I don't think you want the backgrounds in that tiny 35x35px image?

Change both multiimages from your code in the first post to this:
PHP Code:
<control type="image">
    <
posx>0</posx>
    <
posy>0</posy>
    <
width>1280</width>
    <
height>720</height>
    <
texture background="true">$VAR[HomeBackgroundVar]</texture>
    <
fadetime>1000</fadetime>
</
control
Image
Reply
#5
It works! Thank you very very much!! I was able to add a second button with the same behaviour.
Reply
#6
is this still valid ? as its not working for me.

i am using confluence on koid 17.
Reply

Logout Mark Read Team Forum Stats Members Help
Change of background when button focused0