Kodi Community Forum

Full Version: Focus issue with script running button
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
No doubt the problem is really simple, but I have been staring at this for a while and I can't spot what's wrong. If someone could look over my shoulder and point out where the error is, it would be greatly appreciated.

Anyway the problem is that when I first enter the MyVideoNav.xml that I have included the following code

PHP Code:
<control type="button" id="1">
            <
description>run WOL script</description>
            <
onfocus>XBMC.RunScript($INFO[Skin.String(wake-scriptpath)])</onfocus>
            <
onfocus>SetFocus(50)</onfocus>
            <
texturenofocus>-</texturenofocus>
            <
texturefocus>-</texturefocus>
            <
visible>Skin.HasSetting(wake-source)</visible>
        </
control>
        <
control type="button" id="1">
            <
description>bypass running of WOL script</description>
            <
onfocus>SetFocus(50)</onfocus>
            <
texturenofocus>-</texturenofocus>
            <
texturefocus>-</texturefocus>
            <
visible>!Skin.HasSetting(wake-source)</visible>
        </
control
I have the following shown in the debug log

ERROR: Control 50 in window 10024 has been asked to focus, but it can't

If I navigate back to the home menu and then navigate back to MyVideoNav.xml the SetFocus seems to work fine. The button id is not used anywhere in the MyVideoNav.xml or any of the views that I can see, so I'm assuming that is not the problem. I have the following line at the top of the file

PHP Code:
<defaultcontrol always="true">1</defaultcontrol
So as far as I can see what should be happening is
  • Button 1 gets focus and runs the script if users has Skin.HasSetting(wake-source) set to true
  • Focus is then set to id=50 (the list view) and should carry on as it had before my change.
Either way the first key press in any of the views seems to be ignored and it is not until the second key press that I start to navigate around the selected view.

As I said, probably something really simple, but I just can't see it.
Help!!

Wyrm (xTV-SAF)
wyrm Wrote:Either way the first key press in any of the views seems to be ignored and it is not until the second key press that I start to navigate around the selected view.

i bumped into a very similar issue a few days ago.

using this code in DialogVideoInfo.xml

Code:
<defaultcontrol always="true">999</defaultcontrol>

        <control type="button" id="999">
            <onfocus>Skin.ToggleSetting(Foo)</onfocus>
            <onfocus>SetFocus(8)</onfocus>
            <texturenofocus>-</texturenofocus>
            <texturefocus>-</texturefocus>
         </control>

this all works fine, but after closing the video info dialog,
the first keypress is ignored.

somehow the SetFocus() action is messing things up...
ronie Wrote:i bumped into a very similar issue a few days ago.

using this code in DialogVideoInfo.xml

Code:
<defaultcontrol always="true">999</defaultcontrol>

        <control type="button" id="999">
            <onfocus>Skin.ToggleSetting(Foo)</onfocus>
            <onfocus>SetFocus(8)</onfocus>
            <texturenofocus>-</texturenofocus>
            <texturefocus>-</texturefocus>
         </control>
this all works fine, but after closing the video info dialog,
the first keypress is ignored.

somehow the SetFocus() action is messing things up...
Ronie,
Thanks, if you are having a similar problem I don't feel so bad about it being a noob coding issue. I have used something virtually the same in the past and it worked just fine. Maybe it's a build issue, I'm currently using Dharma B2 on Windows XP SP3.

Wyrm (xTV-SAF)