<onfocus>-tag with condition System.IdleTime().
#1
Why does a idle timeout greater than zero fail, when conditioning the <onfocus>-tag ?

Result is in the comment after the various <onfocus> tags :

Code:
                <!--pause-->
                <control type="togglebutton" id="705">
                    <label></label>
                    <altlabel></altlabel>
                    <onclick>PlayerControl(Play)</onclick>
                    <onfocus condition="System.IdleTime(2)">Control.SetFocus(5300,1)</onfocus> <!-- Never. -->
                    <!-- <onfocus>Control.SetFocus(5300,1)</onfocus> --> <!-- Immediate. -->
                    <!-- <onfocus condition="Player.HasVideo">Control.SetFocus(5300,1)</onfocus> --> <!-- Immediate. -->
                    <!-- <onfocus condition="System.IdleTime(1)">Control.SetFocus(5300,1)</onfocus> --> <!-- Never. -->
                    <!-- <onfocus condition="System.IdleTime(0)">Control.SetFocus(5300,1)</onfocus> --> <!-- Immediate. -->
                </control>
Reply
#2
Im guessing the onfocus is poled, ie. it gets checked, then checked again every x amount of time. So it won't run a condition while waiting.
Reply
#3
Because onfocus conditions are checked when the button gains focus. At that time the condition is false because the system hasn't been idle for the required amount of time.
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#4
I resolved this in my addon.
Which is a terrible solution because this is something that belongs in the UI.
I wish that I had never touched upon Kodi skinning. It's a bit of a mess with just XML, and no XSLT transforms and XSD schemas. Everything UI is done in just XML and some Python, which I'm not a big fan of (anymore), when it's not possible (but should be) in XML. The lack of <onXXXXX> tags is somewhat amazing.

But there is hope because JavaScript, Lua and Java are being added : https://github.com/AlwinEsch/kodi-dev-kit
Though it's in pre pre alpha state now. When usable, I will be rewriting my addon to JavaScript rightaway. No more snakes in my HTPC. Tongue
Reply
#5
Like these.. https://forum.kodi.tv/showthread.php?tid=319654
Reply
#6
I'm not sure what you were trying to do, but you could have used an AlarmClock

e.g.
Code:
<onfocus>AlarmClock(myclock1,Control.SetFocus(5300,1),00:02,silent)</onfocus>

And cancel it onunfocus (or onup, ondown etc.).
Code:
<onunfocus>CancelAlarm(myclock1,true)</onunfocus>
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#7
(2017-09-19, 23:32)badaas Wrote: Like these.. https://forum.kodi.tv/showthread.php?tid=319654

Exactly!

We need something like the concept of defining custom events, which is built into JS. And then code event handlers to add/attach to, remove from, and trigger these custom events.
If that project on GitHub goes full monty (not python Tongue ) with the JS implementation we will have all that.

That thread you linked, also puts the finger on the gaps of information in the documentation. For example, nowhere is documented which attributes are allowed, per tag. Which built-in functions and bools are allowed in the condition attribute, per tag.
Just a few points (plus all other Kodi limits, Kodi document structures, etc) an XSD schema (for validation) could resolve.
But I know how hard it is to document, and even harder to keep docs up-to-date. So this is the first and last time I mention this about the Kodi docs Wiki.
I did bump into v17 Kodi development docs though, through that GitHub repo : https://alwinesch.github.io/index.html
But I haven't gone through them to check if they are really for v17 skinning, and more thorough.


For now, I'm stopping skinning activity. It was a fun few weeks. But I'm sticking to default Estuary (or maybe Grid) with a few mods.
Reply

Logout Mark Read Team Forum Stats Members Help
<onfocus>-tag with condition System.IdleTime().0