Kodi Community Forum

Full Version: ControlGroup().HasFocus() not working in custom window?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have my clock among other things in a custom window, and wanted to slide it to the right when opening the submenu in MyVideoNav.xml (id=9000, as default in confluence). I tried using this code:
PHP Code:
<animation effect="slide" start="0" end="250,0" time="300" condition="ControlGroup(9000).HasFocus">conditional</animation

This works great, if I use it in MyVideoNav.xml directly, but not when added to my custom window. Nothing happens.

Try it by replacing custom_SideMenuHelp.xml in confluence with this:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<window type="dialog" id="50">
    <zorder>2</zorder>
    <visible>!Window.IsVisible(startup)</visible>
    <controls>
        <control type="label">
            <centerleft>640</centerleft>
            <centertop>360</centertop>
            <width>auto</width>
            <height>50</height>
            <textcolor>FF0000FF</textcolor>
            <shadowcolor>FF000000</shadowcolor>
            <font>WeatherTemp</font>
            <align>center</align>
            <aligny>center</aligny>
            <label>test</label>
            <animation effect="slide" start="0" end="250,0" time="300" condition="ControlGroup(9000).HasFocus">conditional</animation>
        </control>
    </controls>
</window>
enter MyVideoNav and open the left hand options menu.

This was tested using XBMC 13.0-ALPHA12 Git:20140202-65ad3ae on Win32.


Also, on another note. I'm trying to adapt to using the new left/top/centerleft etc system introduced recently, but struggling with centerleft/centertop. As seen above, I tried centering the label in the window, but it appears centerleft positions the label with the first letter at the center, same as what left would do. I would expect it to center it starting at the center of the control, no?
Your custom window does not know controlgroup 9000 as its in a different window (myvideonav). This is by design to keep controls from bleeding through windows. Your best bet is to set a property when controlgroup 9000 is focused and clear it when unfocused and base the slide animation on that property.
I see. Makes sense. Will do so, thanks!