Kodi Community Forum

Full Version: condition onfocus if/else
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
have a layout with 2 controls, each control is visible with a condition, the problem is that I cant say which one have the default focus when is pressed select key.
I make each control have the same id and set this id as de default if but only request focus in first button the other control only work when select key is pressed twice
the layout is something like that

Code:
<?xml version="1.0" encoding="UTF-8"?>
    <window>
        <defaultcontrol always="true">1</defaultcontrol>
        <controls>
            <control id="1" type="button">
                <visible>CONDITION</visible>
                <description>DESC A</description>
                <posx>0</posx>
                <posy>0</posy>
                <width>1280</width>
                <height>720</height>
                <texturefocus>-</texturefocus>
                <texturenofocus>-</texturenofocus>
                <onclick>ACTION A</onclick>
            </control>
            <control id="1" type="button">
                <visible>CONDITION</visible>
                <description>DESC B</description>
                <posx>0</posx>
                <posy>0</posy>
                <width>1280</width>
                <height>720</height>
                <texturefocus>-</texturefocus>
                <texturenofocus>-</texturenofocus>
                <onclick>ACTION B</onclick>
            </control>
        </controls>
    </window>

any solution to fix that?
Make it a togglebutton with conditional onclicks?
dont work
still need to press 2 times on key_enter to win focus
would this work for you:
Code:
<?xml version="1.0" encoding="UTF-8"?>
    <window>
        <onload condition="CONDITION1">SetFocus(1)</onload>
        <onload condition="CONDITION2">SetFocus(2)</onload>
        <controls>
            <control id="1" type="button">
                <visible>CONDITION1</visible>
                <description>DESC A</description>
                <posx>0</posx>
                <posy>0</posy>
                <width>1280</width>
                <height>720</height>
                <texturefocus>-</texturefocus>
                <texturenofocus>-</texturenofocus>
                <onclick>ACTION A</onclick>
            </control>
            <control id="2" type="button">
                <visible>CONDITION2</visible>
                <description>DESC B</description>
                <posx>0</posx>
                <posy>0</posy>
                <width>1280</width>
                <height>720</height>
                <texturefocus>-</texturefocus>
                <texturenofocus>-</texturenofocus>
                <onclick>ACTION B</onclick>
            </control>
        </controls>
    </window>
already try but the 2nd onload overwrite the 1st onload
already solve the problem

instead a togglebutton i use a button with 2 onlick each one have a condition