Control can't have default focus if animation contains a delay
#1
I have the following simple DialogVideoInfo.xml

xml:
<window>
  <defaultcontrol always="true">8</defaultcontrol>
  <onload>SetFocus(8)</onload>

  <controls>
    <control type="button" id="8">
      <animation effect="fade" start="0" end="100" time="200" delay="150">WindowOpen</animation>
      <width>340</width>
      <include>InfoButtonTemplate</include>
      <label>&#x25b7; Play</label>
    </control>
  </controls>
</window>

Basically when the DialogVideoInfo is opened there is a small 150ms delay before the button is faded into view, however even with the default control and onload setfocus the control doesn't get focused. However if I remove the delay from the animation then the control focuses fine. This is running on Nexus, haven't test on Matrix.


EDIT:

Fixed by adding:-

<visible allowhiddenfocus="true">true</visible>

to the control, which makes no sense as a faded control should not be treated as hidden.
Reply
#2
Is this to do with the issue previously with nexus and controls with 0 visibility?
https://forum.kodi.tv/showthread.php?tid=368917
Reply
#3
No, that issue has already been fixed and merged:- https://github.com/xbmc/xbmc/pull/21645

Besides, as I said if I remove the delay=150 from the animation it works perfectly, so it's nothing to do with the fade going to 0.
Reply
#4
If you're on nexus could use a skin timer to delay setting focus (or a silent alarmclock on Matrix but it doesn't have as fine control).
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#5
(2022-10-17, 03:48)jurialmunkey Wrote: If you're on nexus could use a skin timer to delay setting focus (or a silent alarmclock on Matrix but it doesn't have as fine control).

Thanks, but as I said it's fixable using <visible allowhiddenfocus="true">true</visible> on the button control.

It's just strange that if you add a delay to the animation then Kodi treats the control as having a visibility of False until after the delay.
Reply
#6
Doesn't that make sense though? Because visibility would be 0 until 200ms. In my skin since Nexus, it seems that visibility = 0 means a control is considered hidden. With my scrollbars, I had to similarly add allowhiddenfocus="true" for them to be able to receive focus. But I assumed this was due to that aforementioned issue that was fixed. All I know is that the code that worked on Matrix no longer works on Nexus
Reply
#7
Quote:Doesn't that make sense though? Because visibility would be 0 until 200ms.

No because visibility isn't 0 until 200ms, the fade opacity is 0 until 200ms. The visibility of a control is changed with the <visible> tag not with a fade animation, a fade animation only changes the opacity. Just because you fade the control down to 0 (transparent) shouldn't mean it changes the <visible> tag from true to false.

That was the whole point of that pull request, controls that faded down to 0 were changing there <visible> tag to false and breaking layouts. Now it appears that a similar thing is happening with animations that contain delays, the controls <visible> tag is being set to false until the delay has finished. An animation should never affect or override the <visible> tag of a control.
Reply
#8
This is different to the issue with 0% conditional being treated as not visible though. Conditional animations are not visible animations.

If it worked how you suggest, IsVisible would be false even though a control is still on screen during its windowclose and hidden animation. There's a reason there's also an IsActive state as well as IsVisible.

At window activation, all controls are initially in a hidden state. They only become visible once the window loads otherwise events would trigger too early.

Animation delay on visible/windowopen is the only method available to delay visibility state change and match events to animations. For instance, look at how the estuary widget bumpers delay bouncing focus back by 400ms
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#9
@jurialmunkey Thanks for the explanation.
Reply

Logout Mark Read Team Forum Stats Members Help
Control can't have default focus if animation contains a delay0