Kodi Community Forum

Full Version: button focus
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, new member here. i joined up as i'm having a bit of trouble getting some buttons to take focus when using the left/right arrow keys on the keyboard. the end result will be used with a remote control.

two of the buttons work but it wont select the third for some reason.

the buttons are on the home screen

if someone could kindly look at the code and tell me where i'm going wrong. much appreciated.

 </control>
<control type="group" id="10">
<depth>DepthFooter</depth>
<left>10</left>
<top>55r</top>
<include>Window_OpenClose_Animation</include>
<control type="button" id="20">
<description>Power push button</description>
<left>1200</left>
<top>0</top>
<width>50</width>
<height>50</height>
<label>31003</label>
<font>-</font>
<onclick>ActivateWindow(ShutdownMenu)</onclick>
<texturefocus border="5">floor_buttonFO.png</texturefocus>
<texturenofocus border="5">floor_button.png</texturenofocus>
<onleft>21</onleft>
<onright>21</onright>
<onup>9002</onup>
<ondown>9003</ondown>
</control>
<control type="image">
<description>Power Icon</description>
<left>1200</left>
<top>0</top>
<width>50</width>
<height>50</height>
<aspectratio>keep</aspectratio>
<texture>icon_power.png</texture>
</control>
<control type="button" id="21">
<description>File Manager push button</description>
<left>1140</left>
<top>0</top>
<width>50</width>
<height>50</height>
<label>10366</label>
<font>-</font>
<onclick>ActivateWindow(FileManager)</onclick>
<texturefocus border="5">floor_buttonFO.png</texturefocus>
<texturenofocus border="5">floor_button.png</texturenofocus>
<onleft>20</onleft>
<onright>20</onright>
<onup>9002</onup>
<ondown>9003</ondown>
</control>
<control type="image">
<description>Filemanager Icon</description>
<left>1140</left>
<top>0</top>
<width>52</width>
<height>52</height>
<aspectratio>keep</aspectratio>
<texture>icon_filemanager.png</texture>
</control>
<control type="button" id="22">
<description>Settings push button</description>
<left>1080</left>
<top>0</top>
<width>50</width>
<height>50</height>
<label>1036</label>
<font>-</font>
<onclick>ActivateWindow(Settings)</onclick>
<texturefocus border="5">floor_buttonFO.png</texturefocus>
<texturenofocus border="5">floor_button.png</texturenofocus>
<onleft>19</onleft>
<onright>19</onright>
<onup>9002</onup>
<ondown>9003</ondown>
</control>
<control type="image">
<description>Settings Icon</description>
<left>1082</left>
<top>2</top>
<width>46</width>
<height>46</height>
<aspectratio>keep</aspectratio>
<texture>icon_system_2.png</texture>
</control>
</control>
(2017-12-23, 04:37)Bibio Wrote: [ -> ]two of the buttons work but it wont select the third for some reason.
These buttons were taken from Confluence.
And since originally there were only 2 buttons, the onleft & onright actions for each button were the same since you would end up focused on the same button no matter if you went right or left.
Now that you have added a button (or are trying to at least), the onleft & onright actions need to change accordingly:
xml:
        <control type="group" id="10">
            <depth>DepthFooter</depth>
            <left>10</left>
            <top>55r</top>
            <include>Window_OpenClose_Animation</include>
            <control type="button" id="20">
                <description>Power push button</description>
                <left>1200</left>
                <top>0</top>
                <width>50</width>
                <height>50</height>
                <label>31003</label>
                <font>-</font>
                <onclick>ActivateWindow(ShutdownMenu)</onclick>
                <texturefocus border="5">floor_buttonFO.png</texturefocus>
                <texturenofocus border="5">floor_button.png</texturenofocus>
                <onleft>22</onleft>
                <onright>21</onright>
                <onup>9002</onup>
                <ondown>9003</ondown>
            </control>
            <control type="image">
                <description>Power Icon</description>
                <left>1200</left>
                <top>0</top>
                <width>50</width>
                <height>50</height>
                <aspectratio>keep</aspectratio>
                <texture>icon_power.png</texture>
            </control>
            <control type="button" id="21">
                <description>File Manager push button</description>
                <left>1140</left>
                <top>0</top>
                <width>50</width>
                <height>50</height>
                <label>10366</label>
                <font>-</font>
                <onclick>ActivateWindow(FileManager)</onclick>
                <texturefocus border="5">floor_buttonFO.png</texturefocus>
                <texturenofocus border="5">floor_button.png</texturenofocus>
                <onleft>20</onleft>
                <onright>22</onright>
                <onup>9002</onup>
                <ondown>9003</ondown>
            </control>
            <control type="image">
                <description>Filemanager Icon</description>
                <left>1140</left>
                <top>0</top>
                <width>52</width>
                <height>52</height>
                <aspectratio>keep</aspectratio>
                <texture>icon_filemanager.png</texture>
            </control>
            <control type="button" id="22">
                <description>Settings push button</description>
                <left>1080</left>
                <top>0</top>
                <width>50</width>
                <height>50</height>
                <label>1036</label>
                <font>-</font>
                <onclick>ActivateWindow(Settings)</onclick>
                <texturefocus border="5">floor_buttonFO.png</texturefocus>
                <texturenofocus border="5">floor_button.png</texturenofocus>
                <onleft>21</onleft>
                <onright>20</onright>
                <onup>9002</onup>
                <ondown>9003</ondown>
            </control>
            <control type="image">
                <description>Settings Icon</description>
                <left>1082</left>
                <top>2</top>
                <width>46</width>
                <height>46</height>
                <aspectratio>keep</aspectratio>
                <texture>icon_system_2.png</texture>
            </control>
        </control>

Tip: Try and use the "insert syntax" button (</>) with the proper syntax whenever posting snippets of code as otherwise it is rather difficult to read.
aha, i get it now. onleft/onright are the selections sequence of a given button ID #

thank you kindly :-)

i'll use the "insert syntax" from now on.